Help with bugs in audio player

R_Gol's icon

R_Gol

8月 05 2024 | 6:18 午前

I have this following patch:

Max Patch
Copy patch and select New From Clipboard in Max.

I'm receiving a data from two sensor that in some conditions output either 1 or 0 and play or pause the audio player.

I am facing some bugs that if I have rapid changes between 0 and 1 back and forth sometime the player is stuck (not playing) although receiving 1 from the input that should play. Any idea why is that?

is there a way I could smooth the transient in the patch?

another question - how can I play a different song each time one is finished?

To have aa bank of 4 song that when one is finished it will move to the next one?

last question? how can I use the distance data to control the volume? the more distance is far volume is low and the more distance is getting closer to 0 volume is going up?

Source Audio's icon

Source Audio

8月 05 2024 | 9:17 午前

1- scale expected max distance range to volume , is that so hard to do ?

maybe add clip to avoid too much volume

2- if input is stable (not changing) for set time, then output.

R_Gol's icon

R_Gol

8月 05 2024 | 5:58 午後

Thanks for the above.

Regarding of move frpm one audio to another when finished. I try the following:

in the same folder my patch is I have 3 audio files: audio1 audio2 and audio3.

I try that the patch will start from audio1 and whenever is finish it will load the next file (audio2) then when finished - it will load audio3. when this done it will be back to audio1 and so on..

What am I doing wrong?

Max Patch
Copy patch and select New From Clipboard in Max.

R_Gol's icon

R_Gol

8月 06 2024 | 5:49 午前

ok I think I figure it out:

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

Source Audio

8月 06 2024 | 6:40 午前

too complicated.

why seek 1000 ?

R_Gol's icon

R_Gol

8月 06 2024 | 7:38 午前

why seek 1000 ?

because the audio files I'm working with are not starting exactly at 0

Source Audio's icon

Source Audio

8月 06 2024 | 7:54 午前

well then open $1, seek 1000

R_Gol's icon

R_Gol

8月 06 2024 | 8:17 午前

Thanks. Is there a way to make the menu object to be updated automatically when opening the patch and load the names of te audio files that are in the same folder as the patch?

Source Audio's icon

Source Audio

8月 06 2024 | 9:10 午前

check umenu help file

autopopulate and file types

R_Gol's icon

R_Gol

8月 06 2024 | 11:41 午前

I have the following:

Max Patch
Copy patch and select New From Clipboard in Max.

when song is finished is indeed move to the next one. when I open the unmenu object and try to change song manually it is not working. sometimes jump to a different song then the one I press and sometimes does not move at all.

R_Gol's icon

R_Gol

8月 12 2024 | 7:31 午後

Problem is still happening. Any idea, seems like a bug (?)

Source Audio's icon

Source Audio

8月 12 2024 | 10:46 午後

no bug, bad patch

Max Patch
Copy patch and select New From Clipboard in Max.

R_Gol's icon

R_Gol

8月 13 2024 | 2:12 午後

in this patch:

Max Patch
Copy patch and select New From Clipboard in Max.

I did not want the song will start automaticlly when chaging it using the dropdown menu and therefore I change the message [open $1, 1) to [open $1, 0)

now when I'm pressing the main toggle (manual on off) to start and pause the song it won't work

What should I change?

Source Audio's icon

Source Audio

8月 13 2024 | 9:10 午後

open $1, 0 message makes no sense at all.

if a file is playing, openning a new file stops it anyway.

If you want to open new file using manual selection in umenu without starting playback, all you need is open $1.

On the other hand, if you want to auto load AND play next file when

done playing bang triggers, you need to develop logic arround all that.

you will have to play with gates and trigger to get that working.

After so many years spent with max, you should be able to get that done

without me or anyone else doing that for you.

As usuall, one can only guess what you really want.

Maybe you want to manually stop the playback without producing

that done playing bang ?

Let it out only if file really played to the end ?

Or keep starting next songs as long as play button is active ?

then stop all when selection is made by selecting a file in umenu ?

How would you know if that was done by mouse or by recalling that

menu item from somewhere, like preset or live automation ?

Should that make a difference at all ?

It is not possible to help you unless you state clearly what exact behaviour

of play , pause , resume, stop and relation of that main play toggle

to auto next song should be.

R_Gol's icon

R_Gol

8月 14 2024 | 4:09 午前

Maybe you want to manually stop the playback without producing

that done playing bang ?

Let it out only if file really played to the end ?

Or keep starting next songs as long as play button is active ?

then stop all when selection is made by selecting a file in umenu ?

How would you know if that was done by mouse or by recalling that

menu item from somewhere, like preset or live automation ?

Should that make a difference at all ?

You state here very good question I did not ask myself before..

This what I was looking for: keep starting next songs as long as play button is active

then stop all when selection is made by selecting a file in umenu

In any case, I should really figure it out myself by now... In that you are right...

Thanks for all your insights..!

Source Audio's icon

Source Audio

8月 14 2024 | 4:57 午前

When you post exacty what the goal is, things become easier to handle.

In the patch below grab object is used to pick next menu item,

so that song auto starts.

When selection comes directy from umenu it stops.

Max Patch
Copy patch and select New From Clipboard in Max.

Now that toggle is used for playback, it can control the gate

for auto next on done playing bang.

R_Gol's icon

R_Gol

8月 14 2024 | 7:44 午前

This is great! but I'm facing issue when using the system that should restart the song to start if x time has passed without new data.

When that time is elapsed - on next 1 (song should start) nothing is happening:

As long the system is not reaching the reset time all is working great. When reset - song won't start on next 1.

What I'm trying to happen:

When toggle is 1 song resume, when 0 song pause.

if song arrive to the end - move to next one on menu list

if more then x seconds passed when toggle is 0 - on next 1 start song from the beginning.

Regarding the unmenu - stop all when selection is made by selecting a file in umenu then on next 1 start song from the beginning

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

Source Audio

8月 14 2024 | 3:07 午後

your patch is too complicated.

You use too many send / receive objects for close connections.

I simply can't work with that.

Your explanation of what you now want is not precise.

"if more then x seconds passed when toggle is 0 - on next 1 start song from the beginning."

Which song ? current song or NEXT song from umenu ?

You need play status detector.

use sync outlet of sfplay~

if it is > 0. means song started , if not it is stopped

if value is changing, it plays, if not it is paused

You can use that to build a logic arround play, stop, pause and resume.

Max Patch
Copy patch and select New From Clipboard in Max.

cut green wire to play current song after timer reset.

Leave it as is to play next song

R_Gol's icon

R_Gol

8月 15 2024 | 5:23 午前

This is just great!

the only bug I found is that song name is not updated when switching automatically to next song when previous has done. When changing song manually via the menu bar it is indeed update to the new name

Source Audio's icon

Source Audio

8月 15 2024 | 9:15 午前

that is no bug, I just forgot about display of playing file.

You should be able to find out how to patch that , or ?

You must see what happens in the patch, how does sfplay~ know what to play next ?

I explained that it comes from grab object because you need to separate

direct output from umenu (which stops the playback).

Max Patch
Copy patch and select New From Clipboard in Max.

Lucy Victoria's icon

Lucy Victoria

8月 16 2024 | 5:59 午前

Rapid changes in sensor output may cause the player to get stuck. Implement debouncing to smooth out these transitions by only reacting to sustained changes.

To play a different song each time, use a playlist and move to the next song after one finishes, looping back to the start when needed.

Map the distance data to control volume, with a formula like volume = 1 - (distance / max_distance), ensuring that volume increases as the distance decreases.

R_Gol's icon

R_Gol

8月 25 2024 | 5:51 午前

[FIXED]

I have added a system to show song duration but it is not show the current song time if song move to the next one automatically. When I manually choose a different song it is showing the song duration

Source Audio's icon

Source Audio

8月 25 2024 | 8:50 午後

same problem and same solution as with song name display.