advanced playback system based on some condition

R_Gol's icon

I have a box I build with 5 buttons and 2 potentiometers.

1 main button to start the system

another 4 button 1 for each specific audio files and another 2 potentiometer to change the pitch of 2 of the 4 files.

My system has 4 chapter the each chapter has is audio file that should play 1 time. each chapter has 4 different unique files that user can trigger them with the corresponding buttons and two of the 4 the user can change their pitch using pots.

when user enter room he press the main button that start the audio file of first chapter and loading the 4 audio files of that chapter.

when the first chapter is finished it will automaticlly start the next audio file of chapter two and will load the 4 audio files of chapter two. same goes to chapter 3 and 4.

the reset button will start the whole sequence from the beginning.

if there was not press on none of the user buttons the system automaticly will reset to first chapter on next main button press.

how I should build this complex system?

I thought about using 1 sfplay object to load and play the main audio files of each chapters and another 2 sfplay for 2 of the 4 audio files of each chapter and another 2 groove objects for 2 of the 4 audio files of each chapter (the ones that can be effected with pots on pitch)

some condiotions of playback playing:

Main AudioA start on BTNMAIN press, when finished Main AudioB start, when finished Main AudioC start, when finished - Main Audio D start, when finished - wait for next BTNMAIN press to start from beginning,

when Main AudioA is playing the usrfileA1, usrfileA2, usrfileA3, usrfileA4, are availible to play with.

usrfileA1, usrfileA2 are 1 shot trigger (play 1 time from start to end when press)

usrfileA3, usrfileA4 are playing as long the button is pressed and pot 1 and pot 2 will effect the pitch of those files.

Source Audio's icon

you don't need any complex system.

just follow automatic stuff and insert interrupts for user actions.

audio files that user can trigger can all be played by a single sfplay~ instance

which also can vary the playback speed.

so at the end all you need is player 1 preloaded with 4 main files,

and player 2 preloaded with 16 user playable files.

preloaded actually means to have available file paths to load and play,

no need to preload them really.

user buttons 1 & 2 reset play speed or pitch and disable that pot(s),

buttons 3 & 4 use press/release to start/stop playback

and enable pot(s)

by the way why 2 pots if only one file can be played at a time ?

R_Gol's icon

and player 2 preloaded with 16 user playable files.

it should be able to play 4 usr files together. so it must have 1 player for each 4 files

by the way why 2 pots if only one file can be played at a time ?

4 files can theoretically play at one time.

the 2 files usrFileA and userFileB can trigger from btn1 and btn2

the 2 files usrFileC and userFileD can be played from btn3 and btn4 (as long is pressed) and be effected from pot 1 and pot 2

Source Audio's icon

so 5 players alltogether

have a look at this.

load each umenu with needed files.

master

and 1 2 3 4 for each part

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

I am away for the rest of the day ....

R_Gol's icon

Thanks!

How it is possible to add the following:

if 1 of the 4 buttons was not press for x time (lets say 1 minute) it will stop everything from work and only when Main button is pressed it will start the system again?

the above solved like this:

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


How it is possible to mix the 4 sfplays so if only 1 file is playing the gain will be 1. if 2 - gain 0.5, oif 3 - gain 0.33 and if 4 - gain 0.25 ?

Source Audio's icon

after all this years with max, you have to ask such things ?

R_Gol's icon

after all this years with max, you have to ask such things ?

I am Gonna solved it myself. you are right

R_Gol's icon

solved:

👽'tW∆s ∆lienz👽's icon

the gain will be 1. if 2 - gain 0.5, oif 3 - gain 0.33 and if 4 - gain 0.25 ?

...

Gonna solved it myself. you are right

hahaha 😂 these forums are the most hilarious when people are familiar with each other...

just a hint... what you've listed are simply reciprocals:

2 = gain 0.5 = 1/2

3= gain 0.33 = 1/3

4 = gain 0.25 = 1/4

[!/ 1.] <- this object(also known as 'rdiv' or "reverse divide") is the most helpful here(beyond that, you just have to make sure your system keeps track of how many are playing at once)

R_Gol's icon

[!/ 1.] <- this object(also known as 'rdiv' or "reverse divide") is the most helpful here(beyond that, you just have to make sure your system keeps track of how many are playing at once)

Thanks! this much more elegant but I will stay with coll so I will be able to fine tune the values

Source Audio's icon

not really solved.

as players 1 & 2 are one shot, you need finished bang to recalculate gain.

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

R_Gol's icon

Thanks for the above!

how can I add a time stamp of the main audio files when playing? so I can know how time is passed until finished the current file?

Roman Thilenius's icon

count~?

.

.

.

.

R_Gol's icon

I am getting the time elapsing since file start playing (from the help file). I don't see how to get the total duration of the current file in sfplay~

edit: I found it -- > sfinfo~

R_Gol's icon

How can I add a "debug" option to jump to a specific audio file without breaking the system?

Source Audio's icon

Now one has to understand what means to break the system ?

R_Gol's icon

Now one has to understand what means to break the system ?

When I manualy change the umenu to different file that it is not the one that playing the behavior of the system change and for some reason when I press on audio file 2 in the umenu it jumps to the next one after

Source Audio's icon

that is because main sfplay bangs when done playing

and triggers the rest of the logic, including next message to umenu.

main menu selected starts clocker and sets ggate

to trigger next or reset- if selected umenu number is 3 - last file.

You should be able to deal with that simple logic.

what is there to debug for 4 file playback ?

R_Gol's icon

what is there to debug for 4 file playback ?


for example if I want to check audio file 3 and don't want to wait for audio 1 and 2 to finish

Source Audio's icon

You can play any audio file even without max to check how it sounds.

If it has to be inside your patch,

then you can either use another, independent

sfplay instance or deactivate auto next, clocker

etc while using this"debug" function