Help with bugs in audio player
I have this following patch:
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?
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.

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?
ok I think I figure it out:
too complicated.
why seek 1000 ?

why seek 1000 ?
because the audio files I'm working with are not starting exactly at 0
well then open $1, seek 1000
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?
check umenu help file
autopopulate and file types
I have the following:
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.
Problem is still happening. Any idea, seems like a bug (?)
no bug, bad patch
in this patch:
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?
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.
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..!
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.
Now that toggle is used for playback, it can control the gate
for auto next on done playing bang.
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
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.
cut green wire to play current song after timer reset.
Leave it as is to play next song
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
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).
[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
same problem and same solution as with song name display.