Author Topic: 4Klang Software Synthesizer usage in Purebasic  (Read 4693 times)

0 Members and 1 Guest are viewing this topic.

Offline energy

  • Amiga 1200
  • ****
  • Posts: 280
  • Karma: 25
    • View Profile
Here is the Purebasic wrap for 4klang.

http://4klang.untergrund.net/

I dont think that its no good to use 4klang with PB, incase
PB does not support crinkler...
But have fun...
« Last Edit: July 18, 2011 by energy »
coding: jwasm,masm
hobby: www.scd2003.de

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17374
  • Karma: 497
  • evil/good
    • View Profile
    • My Homepage
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #1 on: July 20, 2011 »
Thanks for posting your wrapper :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline padman

  • Senior Member
  • Pentium
  • ********
  • Posts: 977
  • Karma: 258
    • View Profile
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #2 on: July 20, 2011 »
Yup, this looks interesting. Thanks for posting. The only downside is, that you gotta write your own songs. Or is there a site where one can download songs?
Challenge Trophies Won:

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #3 on: July 20, 2011 »
Yup, this looks interesting. Thanks for posting. The only downside is, that you gotta write your own songs. Or is there a site where one can download songs?

I had a look round for 4klang songs a while back and there don't really seem to be many around.

I did find this fantastic demo on youtube showing off 4klang though. It's so realistic! Cloth simulation, rigid-body physics and superb music syncing: http://www.youtube.com/watch?v=7qb4uiczfeE
raizor

Challenge Trophies Won:

Offline padman

  • Senior Member
  • Pentium
  • ********
  • Posts: 977
  • Karma: 258
    • View Profile
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #4 on: July 20, 2011 »
lol, yep, that's truly amazing. K+  :D
Challenge Trophies Won:

Offline energy

  • Amiga 1200
  • ****
  • Posts: 280
  • Karma: 25
    • View Profile
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #5 on: July 20, 2011 »
yes yu have to compose for yurself. 4klang generates an obj. with the renderer and sound
inbuilt. so there's no need of an external replay routine.
to compose i take fruity loops.
As yu see in attachment same song as above done in jwasm+crinkler 1.3
is about 1,8k with 49sec to play!!
 
coding: jwasm,masm
hobby: www.scd2003.de

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #6 on: July 21, 2011 »
yes yu have to compose for yurself. 4klang generates an obj. with the renderer and sound
inbuilt. so there's no need of an external replay routine.
to compose i take fruity loops.
As yu see in attachment same song as above done in jwasm+crinkler 1.3
is about 1,8k with 49sec to play!!

You can make 4KLang songs in Fruity Loops?
raizor

Challenge Trophies Won:

Offline energy

  • Amiga 1200
  • ****
  • Posts: 280
  • Karma: 25
    • View Profile
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #7 on: July 21, 2011 »
I just tested it out.
i tried with demo of fruity Loops.



coding: jwasm,masm
hobby: www.scd2003.de

Offline Raizor

  • Founder Member
  • Pentium
  • ********
  • Posts: 1150
  • Karma: 174
    • View Profile
    • Raizor's Dev Blog
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #8 on: July 21, 2011 »
I just tested it out.
i tried with demo of fruity Loops.

Cool stuff energy, I will give that a try too. Is it easy to set up?
raizor

Challenge Trophies Won:

Offline energy

  • Amiga 1200
  • ****
  • Posts: 280
  • Karma: 25
    • View Profile
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #9 on: July 21, 2011 »
let s say so. its hard to do music with that appz.
But i tested some appz eg madtracker, buzz, which are free.
but for me fruityloop is the best and simplest to compose.
but im not the musician.
coding: jwasm,masm
hobby: www.scd2003.de

Offline niek

  • ZX 81
  • *
  • Posts: 1
  • Karma: 0
    • View Profile
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #10 on: February 18, 2013 »
Thank you very much!! Will try it with version 5.10 of PB.

Watt–Wilton

  • Guest
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #11 on: October 02, 2013 »
Well I dont think that its no good to use 4klang with PB, incase
PB does not support crinkler.

Offline energy

  • Amiga 1200
  • ****
  • Posts: 280
  • Karma: 25
    • View Profile
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #12 on: November 10, 2013 »
Thank you very much!! Will try it with version 5.10 of PB.

Works with 5.20 with changes of an "OR"-Statement.

#Replay = #WHDR_BEGINLOOP Or #WHDR_ENDLOOP
to
#Replay = #WHDR_BEGINLOOP | #WHDR_ENDLOOP
coding: jwasm,masm
hobby: www.scd2003.de

Offline Dad1916

  • Atari ST
  • ***
  • Posts: 110
  • Karma: 3
    • View Profile
    • Quadriga demo group
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #13 on: November 23, 2013 »
google complaining

The Website Ahead Contains Malware!
Google Chrome has blocked access to 4klang.untergrund.net for now.
Even if you have visited this website safely in the past, visiting it now is very likely to infect your Mac with malware.
Malware is malicious software that causes things like identity theft, financial loss, and permanent file deletion. Learn more

Offline Ampli

  • ZX 81
  • *
  • Posts: 17
  • Karma: 8
    • View Profile
    • StudioRIFF
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #14 on: October 20, 2018 »
Sorry for posting in this old Thread, Is it possible somehow to convert this 4klang usage to PureBasic Linux?

Offline Rbz

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 2708
  • Karma: 484
    • View Profile
    • http://www.rbraz.com/
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #15 on: October 21, 2018 »
Hi Ampli,

Unfortunately I don't have purebasic nor linux installed, but here some ideas for you to research about it.

Using Energy's example, you will need to remove "wimm.lib" and "kernel32.lib" they are windows specific, on linux you will use SDL.

Use something like this:
Code: [Select]
ImportC "-lSDL2"
Here is a "C" code used to setup sdl audio, I think it should be easy to convert to purebasic:

Code: [Select]
static void synthCallback(void *udata, Uint8 *stream, int len) {
/* the music is stereo - use 32 bit for left and right channel */
static int32_t* sample = (int32_t*)synthBuffer;
int32_t* ptr = (int32_t*) stream;

udata += 0;
int i;
for (i = len / (SYNTH_OUTPUT_SAMPLE_SIZE * SYNTH_CHANNELS); i > 0 ; i--) {
/* loop the track */
if (samplePosition >= MAX_SAMPLES) {
samplePosition = 0;
sample = udata;
}
/* copy left and right channel at the same time */
*ptr++ = *sample++;
samplePosition++;
}
}

Code: [Select]
/* audio specification */
SDL_AudioSpec audioSpec;
audioSpec.freq = SAMPLE_RATE;
audioSpec.format = AUDIO_S16SYS;
audioSpec.channels = SYNTH_CHANNELS;
audioSpec.silence = 0;
audioSpec.samples = SYNTH_PLAY_BUFFER;
audioSpec.size = 0;
audioSpec.callback = synthCallback;
audioSpec.userdata = synthBuffer;

/* setup audio */
if (SDL_OpenAudio(&audioSpec, NULL)) {
fprintf(stderr, "SDL_OpenAudio() failed\n");
SDL_Quit();
return EXIT_FAILURE;
}

/* no multicore - precalculate the music */
__4klang_render(synthBuffer);

/* start the music */
SDL_PauseAudio(0);

Another thing to check is how to allocate memory for "synthBuffer", I believe it should be:
Code: [Select]
synthBuffer = AllocateMemory(#MAX_SAMPLES*#SAMPLE_TYPE*2)
Challenge Trophies Won:

Offline Ampli

  • ZX 81
  • *
  • Posts: 17
  • Karma: 8
    • View Profile
    • StudioRIFF
Re: 4Klang Software Synthesizer usage in Purebasic
« Reply #16 on: October 21, 2018 »
Thanks alot, I will look into it and see if I can get it to work.