@KMETE The callback function from the audio driver tells the program when it has finished processing the previous block, but if everything is set correctly and is working well then the program will not need to know..... so leave it off unless you run into problems.
For anyone else...... the above patch sets the block size to 512 and the delay (msec) to 5....... etc.
So it is tailored to @KMETE's soundcard.
You will need to change some parameters at the end of the [audio-dialog x x x ( message if you want to use it to automatically select your card and set it correctly.
The values in the [audio-dialog x x x ( message are detailed in set_audio_parameters.pd
@KMETE I remember that there is no message to set the block size in [audiosettings].
It can be done with a [audio-dialog x x x x x ( message to [s pd] ....... it is the last in the list...... and I can build that into the patch.... but it is best left at 64 if possible so I will only do it if you need to change it for some reason.
Yes..... it will select the correct card when the index changes....... and change it for this run of Pd..... but revert to the previous settings when you open Pd again...... so run it every time you open the patch that requires that card. You can open the Pd Media Audio Settings window and save the settings if you wish..... but if the card has a different index on the next run you will still need to run this patch so that would be pointless.
@KMETE Ok....... I will write it up later, and maybe have to make changes...... but it is simple and seems to work....... this.zip
The screenshot has some hints as to use.....
For ONE output device..... but a more general ordering setting, and input devices will be added..... why not......?
It changes the card to the one you want by symbol recognition..... and does not save the settings.... run it every time you run your patch.
It selects the card you want and sets the channel count and the samplerate...... nothing else... but other parameters can be added..... see my first post in this thread......
If there is a forward slash in the name then it will not match...... i.e. (S/PDIF) ...... and maybe there will be other problems. Maybe they can be escaped in the message, but no time tonight..... very early start tomorrow......
@KMETE P.S. I was sure that I had been down this road before (but unsure because.... getting old).
Finally found it.
Check out this (audiosettingsperpatch.pd) ..... https://forum.pdpatchrepo.info/topic/13217/save-and-recall-midi-settings-in-a-project/8
It should be what you need.
I think you need the [mediasettings] external....... read the whole thread.....
But it looks a bit more complex than I thought at the time.
I will have a go at a better solution.
@meditz You will get there.... but it is rarely easy or obvious.
In Asio4all you have what would be called on a Mac an aggregate device.
So when you select Asio4all in Pd you should be able to communicate with all of the soundcards present.
It is likely that the onboard soundcard is at the top of the list in Asio4all.
So [dac~]..... or [dac~ 1 2] and [adc~] or [adc~ 1 2] would be that card.
If the next soundcard in the list has 4 outputs they will be [dac~ 3 4 5 6] in Pd.
@high_output-5000 I think [matrix~] is the way to go as @alexandros suggests..... as it avoids building a matrix of [*~] controlled by the toggle matrix.
I have dynamically patched audio connections directly in the past... but of course clicks as connections are made and broken.
I had missed [numberbox_matrix] and would definitely have used that to create the messages to [matrix~] if I had found it at the time.
It is a very simple solution with no need for sends and receives. You can pass the messages directly from [numberbox_matrix] to [matrix~] and set the fade time in [matrix~] to avoid clicks.
But it means putting a number 1 or 0 in the numberbox rather than just clicking a toggle....... so building a toggle matrix might be better...... however.....
If you only needed one toggle selected at any time then [grid] is back on Deken thanks to Lucarda..... and if you set x max and y max to the same as the number of squares in the [grid] it will output the data you need to control [matrix~].
So for my twopence...... [grid] and [matrix~] gives instant relief for a single toggle selection.
A Data structure could well be easier to build than a toggle matrix and easier on the cpu @jona.
If you are sending any to any (any input to any filter) you could use radio buttons instead of toggles.
Or Ofelia could do the job........ https://forum.pdpatchrepo.info/topic/11792/ofelia-test-grid .... but is a bit heavy.
@Balwyn Incorrect order causing the lack of sound for first notes...... the 44100 message is sent after the first note passes through...... fixed I think......... vline~wavetable-voice.pd
What is the sample rate in Pd preferences?
The sample rate of your piano sound is 48K.... so for Pd to play the sample at the correct pitch Pd should also be running at 48K and your message should be 48000.
It is likely that the soundcard sample rate is irrelevant as the computer / sound card driver will resample the stream.
So you should add a comment about that to the patch as many will be running Pd at 44100..... or better still use the [samplerate~] object to bang in an automatic correction.... only for those users.
It looks to me as though you might have added the 44100 message for that reason.
Also..... [adsr] and [output~] are missing (for me at least in vanilla)......