ArrayArrayArray BrainModular BrainModular Users Forum 2026-01-18T23:11:38+02:00 https://brainmodular.org/forums/app.php/feed/topic/7358 2026-01-18T23:11:38+02:00 2026-01-18T23:11:38+02:00 https://brainmodular.org/forums/viewtopic.php?t=7358&p=46198#p46198 <![CDATA[Re: Audiofile]]> I had a go with the audiofile command las few days.
I managed to load wav files, but can't save any

here is the part of the code that's not working : (it's included in a function that is called at callback)

CODE:

for (int i = 0; i < m_size; ++i) {sdkSetSampleAudioFile(audioFile, 1,i, m_buffer[i]);}sdkSetChannelsAudioFile(audioFile, 1);sdkSetSizeAudioFile(audioFile, m_size);sdkSaveToDiskAudioFile(audioFile, tempChar, 1);}
/////////////////////////////
if I run it, it will return errors :
[2] Error :
[HydroGen OP V5] CallBack, paramIndex=19

///////////////////////////////////////
tried with

sdkSetChannelsAudioFile(audioFile, 1);
sdkSetSizeAudioFile(audioFile, m_size);
before
for (int i = 0; i < m_size; ++i) {
sdkSetSampleAudioFile(audioFile, 1,i, m_buffer);

same thing
/////////////////////////////////////////

if I comment it and run only SetChannelsAudioFile and SetSizeAudioFile :

[6] Error :
bad pointer in SetChannelsAudioFile
[8] Error :
bad pointer in SetSizeAudioFile

//////////////////

with only: sdkSetSampleAudioFile(audioFile, 1,i, m_buffer);

[2] Error :
[HydroGen OP V5] CallBack, paramIndex=19


/////////////////////////////////////
with only: sdkSaveToDiskAudioFile(audioFile, tempChar, 1);

SDK_SaveToDiskAudioFile :
[0] Error :
PROC:SaveToDiskAudioFile
ERROR:Access violation at address 000000000136CDDE in module 'Usine.exe'. Read of address
0000000000001190

if anyone has a working example using sdkSaveToDiskAudioFile, could you please show it to me !

thanx

Olivar

Statistics: Posted by oli_lab — 18 Jan 2026, 22:11


]]>
2025-05-20T14:55:17+02:00 2025-05-20T14:55:17+02:00 https://brainmodular.org/forums/viewtopic.php?t=7358&p=45845#p45845 <![CDATA[Re: Audiofile]]>
wish me luck

Olivar

Statistics: Posted by oli_lab — 20 May 2025, 14:55


]]>
2025-05-05T19:33:42+02:00 2025-05-05T19:33:42+02:00 https://brainmodular.org/forums/viewtopic.php?t=7358&p=45825#p45825 <![CDATA[Audiofile]]> I'm trying to use the "audiofile" class in the SDK to make a multitrack file but I get some errors :
My idea is to have a multitrack wave file that I can save (or load) and populate it with samples
But I think I get something wrong.
If I want to have a recorder like the "audios ampler recorder" module, do I have to save the samples in a buffer (RAM) and then use the audiofile to save the wave file to disk ?
I'm a bit lost in here.

in .h

TAudioFilePtr audiofile1;

in .cpp

// constructor
multitrackrecorder::multitrackrecorder()

{
audiofile1 = sdkCreateAudioFile();
}

....

//-----------------------------------------------------------------------------
// initialisation
void multitrackrecorder::onInitModule (TMasterInfo* pMasterInfo, TModuleInfo* pModuleInfo)
{
sdkSetChannelsAudioFile(audiofile1, numOfAudiotInsOuts);
sdkSetSizeAudioFile(audiofile1, 60 * sdkGetSampleRate());

}

When loaded in Usine, I get those error messages :
[4] Error :
bad pointer in SetChannelsAudioFile
[6] Error :
bad pointer in SetSizeAudioFile

any idea ?
thanks

Statistics: Posted by oli_lab — 05 May 2025, 19:33


]]>
BrainModular BrainModular Users Forum 2026-01-18T23:11:38+02:00 https://brainmodular.org/forums/app.php/feed/topic/7358 2026-01-18T23:11:38+02:00 2026-01-18T23:11:38+02:00 https://brainmodular.org/forums/viewtopic.php?t=7358&p=46198#p46198 <![CDATA[Re: Audiofile]]> I had a go with the audiofile command las few days.
I managed to load wav files, but can't save any

here is the part of the code that's not working : (it's included in a function that is called at callback)

CODE:

for (int i = 0; i < m_size; ++i) {sdkSetSampleAudioFile(audioFile, 1,i, m_buffer[i]);}sdkSetChannelsAudioFile(audioFile, 1);sdkSetSizeAudioFile(audioFile, m_size);sdkSaveToDiskAudioFile(audioFile, tempChar, 1);}
/////////////////////////////
if I run it, it will return errors :
[2] Error :
[HydroGen OP V5] CallBack, paramIndex=19

///////////////////////////////////////
tried with

sdkSetChannelsAudioFile(audioFile, 1);
sdkSetSizeAudioFile(audioFile, m_size);
before
for (int i = 0; i < m_size; ++i) {
sdkSetSampleAudioFile(audioFile, 1,i, m_buffer);

same thing
/////////////////////////////////////////

if I comment it and run only SetChannelsAudioFile and SetSizeAudioFile :

[6] Error :
bad pointer in SetChannelsAudioFile
[8] Error :
bad pointer in SetSizeAudioFile

//////////////////

with only: sdkSetSampleAudioFile(audioFile, 1,i, m_buffer);

[2] Error :
[HydroGen OP V5] CallBack, paramIndex=19


/////////////////////////////////////
with only: sdkSaveToDiskAudioFile(audioFile, tempChar, 1);

SDK_SaveToDiskAudioFile :
[0] Error :
PROC:SaveToDiskAudioFile
ERROR:Access violation at address 000000000136CDDE in module 'Usine.exe'. Read of address
0000000000001190

if anyone has a working example using sdkSaveToDiskAudioFile, could you please show it to me !

thanx

Olivar

Statistics: Posted by oli_lab — 18 Jan 2026, 22:11


]]>
2025-05-20T14:55:17+02:00 2025-05-20T14:55:17+02:00 https://brainmodular.org/forums/viewtopic.php?t=7358&p=45845#p45845 <![CDATA[Re: Audiofile]]>
wish me luck

Olivar

Statistics: Posted by oli_lab — 20 May 2025, 14:55


]]>
2025-05-05T19:33:42+02:00 2025-05-05T19:33:42+02:00 https://brainmodular.org/forums/viewtopic.php?t=7358&p=45825#p45825 <![CDATA[Audiofile]]> I'm trying to use the "audiofile" class in the SDK to make a multitrack file but I get some errors :
My idea is to have a multitrack wave file that I can save (or load) and populate it with samples
But I think I get something wrong.
If I want to have a recorder like the "audios ampler recorder" module, do I have to save the samples in a buffer (RAM) and then use the audiofile to save the wave file to disk ?
I'm a bit lost in here.

in .h

TAudioFilePtr audiofile1;

in .cpp

// constructor
multitrackrecorder::multitrackrecorder()

{
audiofile1 = sdkCreateAudioFile();
}

....

//-----------------------------------------------------------------------------
// initialisation
void multitrackrecorder::onInitModule (TMasterInfo* pMasterInfo, TModuleInfo* pModuleInfo)
{
sdkSetChannelsAudioFile(audiofile1, numOfAudiotInsOuts);
sdkSetSizeAudioFile(audiofile1, 60 * sdkGetSampleRate());

}

When loaded in Usine, I get those error messages :
[4] Error :
bad pointer in SetChannelsAudioFile
[6] Error :
bad pointer in SetSizeAudioFile

any idea ?
thanks

Statistics: Posted by oli_lab — 05 May 2025, 19:33


]]>