Enterprise Forever

:UK => Programming => Topic started by: ssr86 on 2015.March.27. 15:11:42

Title: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.March.27. 15:11:42
How can I put a musicbox-made tune into my assembler program?
Title: Re: how to put a musicbox tune into program code?
Post by: Zozosoft on 2015.March.27. 15:41:20
Use the COMPILE function then specify the address (XXXX) what you want.
Entry points:
XXXX+0: The A register select the music. Disable IRQ when call this.
XXXX+3: Player IRQ, call it at every 1/50 seconds.
XXXX+6: stop music.
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.March.27. 16:04:10
Thank you, it worked:)

It turned out to be a veeery stupid question because after compiling it even shows you what to do.

Although I had in mind making a ready .tun file to work with my code without the need of loading in it musicbox for recompilation, but I guess that doesn't even make sense because of different start addresses...:oops:

EDIT:

So for sound effects I have to make a couple of small "tunes" and use xxxx+0 to choose between them, right?

But if I wanted to have music always playing and share one channel of music with sound effects?
Would I need two musicbox players code? with the effects' one having priority over the music player?
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.March.27. 16:37:31
And if I wanted to make my own tune, how can I make new and edit patterns? How do I choose and edit instruments?...

I read the hungarian instructions but the google translator wasn't able to do a good job...
So I thought that maybe someone has some experience in working with the tool and could help me...
Title: Re: how to put a musicbox tune into program code?
Post by: Zozosoft on 2015.March.28. 13:36:08
Probably Szipucsu can help you. I'm totally stupid at music :oops:
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.March.28. 13:38:14
I read the hungarian instructions
Where did you read the Hungarian instructions? I don't remember them. Can you link or copy them? I can try to translate them into English.
Title: Re: how to put a musicbox tune into program code?
Post by: Zozosoft on 2015.March.28. 13:53:26
http://ep128.hu/Ep_Util/Music_Box.htm (http://ep128.hu/Ep_Util/Music_Box.htm)
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.March.28. 14:54:15
Where did you read the Hungarian instructions? I don't remember them. Can you link or copy them? I can try to translate them into English.

right there: :D
http://ep128.hu/Ep_Util/Music_Box.htm (http://ep128.hu/Ep_Util/Music_Box.htm)

Thank you, a translation should be very helpful

EDIT:
I somehow managed to figure out how to display the pattern editor, but haven't yet found a way to edit instruments...
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.March.28. 16:02:00
http://ep128.hu/Ep_Util/Music_Box.htm (http://ep128.hu/Ep_Util/Music_Box.htm)
Oh, oh, why isn't it there in the music section (http://ep128.hu/Ep_Music.htm)?

Many years ago I used this program a little, however I found its usage somewhat difficult. (Rather after FL Studio :D )
I try to help you and look at the program again.
There are patterns, you can name them the way you want. One pattern contains some notes, you can edit them. In the middle of the screen there are three big windows, you can see the name of the patterns in them. You have to put patterns after one another, this will be the song. That's what I can remember. Does it help? However, I don't remember how to create a pattern and how to edit its content (notes), I will look at it now in the emulator.
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.March.28. 17:08:04
That's all what I've found out:
First go to one of the three patterns windows and type a name for the pattern (e.g. "first").
Go to the most right side of the line where you typed the pattern, press space, and an arrow will appear (in the attached picture it's "1")
Select "Set" ("2" in the picture) so you will be able to edit the content of the pattern you set with the arrow.
In the 3rd step you have to type in the name, length and envelope of a note but I don't really understand how... :roll:

[attachimg=1]
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.March.28. 17:24:41
But first of all you have to define an envelope.
I attach another file, a demo of the very first steps of creating a song.
However, I don't understand why I cannot hear anything when I select "Play" option at the end...
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.March.28. 18:55:39
Thank you, that was helpful.

Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.March.28. 19:43:05
Thank you, that was helpful.
You are welcome!

However, I don't understand why I cannot hear anything when I select "Play" option at the end...
Does anybody know it?
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.March.28. 22:19:29
Does anybody know it?
I tried playing around with the "skala.tun" and it goes mute when I touch the envelope number and press set... although I set the same value again...
Maybe it's related...
Title: Re: how to put a musicbox tune into program code?
Post by: geco on 2015.March.29. 06:24:54
I tried playing around with the "skala.tun" and it goes mute when I touch the envelope number and press set... although I set the same value again...
Maybe it's related...
I played a bit with the snapshot, and I do not know the Musicbox, but it was strange for me, I could not set amplitude value.
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.April.01. 17:28:14
Imanaged to find the way to "choose" instruments. When you enter the pattern edit menu, you can select a note which parameters you want to edit just like you choose the pattern to edit - press at the right side and an arrow will appear.

Could someone explain me what do the three adsr do? What are these?
(And maybe other parameters too)
Also, when I edit envelope, then I quickly run out of memory (and the envelopes are only couple of values long).
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.01. 23:02:30
I think Musicbox is a bit difficult to use. I prefer Rockdigi.
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.April.01. 23:10:30
But isn't rockdigi only for sample-based music?
However - is there an english manual for this?

I also find musicbox to be not very intuitive but it's the only tracker there is (?) for chip tunes...

EDIT:
what's the cost of playing a 4-channel mod in the background?
Title: Re: how to put a musicbox tune into program code?
Post by: Zozosoft on 2015.April.01. 23:49:41
Another idea: I created a player for the ZX Spectrum PT3 files. The player code is combination of the original PT3 player code (available on the net) and the commonly used AY emulation routine from IstvanV and Geco.

The usage is similar to Musicbox tunes, call the irq player in every 1/50 sec.

For the PT3 files there is an editor on PC.

The problem: not all AY ability can be emulated on Dave. But many PT3 files sounds good on Enterprise.
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.April.02. 00:14:34
But I would really like to use the dave specific features - like the guitar distortion sound szipucsu achieved... AY deosn't have distortion and ring modulation...

Although it seems that I'll have to go with your solution in the end...
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.02. 13:46:33
But I would really like to use the dave specific features - like the guitar distortion sound szipucsu achieved... AY deosn't have distortion and ring modulation...
Sadly, the Musicbox does not support that sort of distortion to gain the guitar sound. Even if it supported that, more precise values would be needed for that distortion. E.g. in the basic you cannot use PITCH 60 with STYLE 16 because it has an useless sounding, you have to use PITCH 60.3 instead. As I know the Music Box doesn't support these non-integer number values...
So, there is no tracker program to reach the guitar sound. Somebody should write such a program first.

I would be very happy if an Enterprise game could use that guitar distortion sound. No game has used it so far - except my "games". :D
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.02. 14:18:45
what's the cost of playing a 4-channel mod in the background?
It is only possible with very simple games. The only game that uses this is Swap (http://www.ep128.hu/Ep_Games/Leiras/Swap.htm).

Here it is on Youtube. (https://www.youtube.com/watch?v=XeU5zVaLufg)
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.April.02. 20:00:48
Sadly, the Musicbox does not support that sort of distortion to gain the guitar sound. Even if it supported that, more precise values would be needed for that distortion. E.g. in the basic you cannot use PITCH 60 with STYLE 16 because it has an useless sounding, you have to use PITCH 60.3 instead. As I know the Music Box doesn't support these non-integer number values...
So, there is no tracker program to reach the guitar sound. Somebody should write such a program first.
:(
I thought (looking at the basic code) that the effect is achieved by setting distortion and ring modulation on the two channels and then treating them as two notes of a fifth or fourth chord... Haven't thought about the real numbers in your code... But even if a tracker doesn't support frequencies outside the standard notes, wouldn't it be possible to modify the frequencies after compiling the tune... Although it would be a looooot of work (and not a good solution I guess)...

It is only possible with very simple games. The only game that uses this is Swap (http://www.ep128.hu/Ep_Games/Leiras/Swap.htm).

But for a title screen or something like that (off-game screens) and with additional 64k (enough?) it should be ok:).
I've never worked with such trackers (sample-based) so I don't have a clue how to operate them...
Could someone give me the basics?
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.02. 20:43:02
I thought (looking at the basic code) that the effect is achieved by setting distortion and ring modulation on the two channels and then treating them as two notes of a fifth or fourth chord... Haven't thought about the real numbers in your code... But even if a tracker doesn't support frequencies outside the standard notes, wouldn't it be possible to modify the frequencies after compiling the tune... Although it would be a looooot of work (and not a good solution I guess)...
Well, this Dave-specific 4 bit distortion is a very special thing and there are no programs that can deal it in the right way. I think this is a problem that nobody has dealt with so far.
First of all, there are only 1-2 tracker programs for the Enterprise. Secondly, they don't take in consideration the Dave characteristics. We would really need a music maker program that uses all the Dave possibilities. Is there no chance to write one?

Anyway, Geco mentioned a method to create a song in IS-BASIC, then load and save it as an escape sequence. I don't know how it works.
Or, you have to write the music player routine in your program code itself. I don't know how difficult it can be. Is it not possible?

But for a title screen or something like that (off-game screens) and with additional 64k (enough?) it should be ok:).
I think it should work without any additional 64k too. Unless you use a very large number of samples that occupy the whole memory. I think, e.g. 32 or 48k is enough for a tracker song, we have a lot of memory left. However I am not very good at coding.

Quote
I've never worked with such trackers (sample-based) so I don't have a clue how to operate them...
Could someone give me the basics?
As I can see Rockdigi (http://ep128.hu/Ep_Util/Rockdigi.htm) has a "Compile" option in the main menu. It should be similar to the MusixBox "Compile" option, I think. But I have never used it...
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.April.02. 21:04:55
Quote
As I can see Rockdigi has a "Compile" option in the main menu. It should be similar to the MusixBox "Compile" option, I think. But I have never used it...
What I meant was - how do i make a new song to compile?
Sorry for asking before even trying to figure it out by myself, but I thought that maybe someone already used it a bit and could lead me through the basics... (maybe a ep128emu demo sequence...) This would be really helpful. (I don't want to reinvent the wheel, I have can't find any manual that I could fully understand)
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.02. 21:42:38
What I meant was - how do i make a new song to compile?
1 - load RDIGI.COM

2 - Select F1 (file functions), select F2 (load sample) and load a sample you wish. After loading a sample you can try it by pressing space. If you don't like it you can delete it from the memory by pressing F6 (del last). If you like the loaded sampe you should load more samples by pressing F2. You can choose different kinds of drums and other things. The samples I prefer are OUTLAW, PIZZA, KFLITER, KORGDOI but you can try anything you want. In the subfolder SAMPLES you can find a lot of samples and other subfolders: BESZED (speech), DOBOK (drums), EFFEKTEK (effects). ZONGORA (piano).
So, you loaded some synth samples and some drums.
From the file menu you can return to the main menu by pressing ESC.

3 - Select F2 (set variables). Here, press F2 (stop position) several times. If you don't do so you will hear only the very first part of your song. Later you can modify here where the song should stop.
Press F3, F4, F5, F6 after one another so you turn on all the 4 digi channels. It is very important, otherwise you won't hear anything.
Hold pressed SHIFT+F7 for some time so you can decrease the tempo. 256 as default is not OK very slow, you need something about 60-80 at least.
Tip: if you edit your song and add more and more patterns but they aren't played, you should increase the stop position.
Press ESC to return to main menu

4 - Select F3: 1st edit mode. Here you can set the patterns. Here you cannot name the patterns (like in Musicbox) but you have to refer to them by the memory adresses. Here you can see CH-1 to CH-4,  the 4 digi channels and the pattern references under them. If you set e.g. 1000 under one of the CHs, the program will play the notes in that CH beginning with 1000 address. In the first coloum under DN you can set the duration. You have to set these values in hex digits.

5 - F4 2nd edit mode. In the 1st edit mode you set e.g. 1000 under one of the channels, you have to go to 1000 in the 2nd edit mode and write there the notes. First you can write the name of the note (C, D, E, F ...), then the octave (from 1 to 4 as I remember) then the number of the sample loaded. E.g. : C_1-01 ( _ stands for space)-this is a C in the 1st octave with the sample 01.

In the main menu you can test your song by F6 (hear music). In the main menu you can even try the actual sample by pressing the keys as if the keyboard were a piano. With the internal joystick you can choose between the loaded samples.

Maybe this is useful for the first time. :)
Title: Re: how to put a musicbox tune into program code?
Post by: Zozosoft on 2015.April.02. 22:00:47
Anyway, Geco mentioned a method to create a song in IS-BASIC, then load and save it as an escape sequence. I don't know how it works.
It is easy, just close the SOUND channel, and reopen as file. Then all sound command saved to the file.
For the playback just send the file data to SOUND channel.

But a machine code program will not use EXOS SOUND device...
Another possible method: with LUA script record the DAVE register writes from the SOUND IRQ routine. Then possible playback these data from machine code program, with a simple IRQ player.

Anyway needed to write new Enterprise music editor!

Sándor Gyányi converted lot of Spactrum games to Enterprise, including Spectrum 128 games. Then coming the idea for make editor/player for the converted Spectrum musics. Then the basis of the Musicbox are the Spectrum musics. If you see the included example musics, most of are from Spectrum games.
This is the reason why the Musicbox not know all Dave ability :-(

For a sound effects can be used IstvanV's Dave simulator (running on PC), where can play all Dave settings.
Title: Re: how to put a musicbox tune into program code?
Post by: geco on 2015.April.03. 09:03:34
Another possible method: with LUA script record the DAVE register writes from the SOUND IRQ routine. Then possible playback these data from machine code program, with a simple IRQ player.
I would use modified EXOS interrupt to do it :)
If you can do the guitar song, or effect in Basic what you would use in your music, or even the whole song in Basic I can catch the Dave register values at every 50Hz, in this way you could insert them to your song. What do you think about it?
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.03. 22:49:28
in this way you could insert them to your song.
You mean "insert them into your program code"? :D
Title: Re: how to put a musicbox tune into program code?
Post by: ssr86 on 2015.April.04. 01:46:10
I would use modified EXOS interrupt to do it :)
If you can do the guitar song, or effect in Basic what you would use in your music, or even the whole song in Basic I can catch the Dave register values at every 50Hz, in this way you could insert them to your song. What do you think about it?

I'll try to learn is-basic sound making sometime later then (because your solution seems the most reasonable for a chance of including the sound) - that is if I think of a good use for the guitar sound.

Meanwhile...
I started composing a guitarless track... One channel drums, one channel melody, one channel bass...
A wip midi is in the attachement.

I'm quite "proud" :oops: of how it came out, although there's something wrong with how it goes to the last part (from 0:28) and the number of bars is odd... (which I think is rather a bad sign). Looping is not that great too, now I think... Can't get the rhytm right in the last section... The theme has only 39 seconds so I don't know if it's not too short for an ingame tune... Maybe doesn't even end up used... However I'm so happy with it now that I felt like showing it:P Finally menaged to use one riff from about 6 years back

I show you the midi, because I have some troubles with vortex tracker (I'm not a chiptune guy)...
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.04. 17:21:11
I started composing a guitarless track... One channel drums, one channel melody, one channel bass...
A wip midi is in the attachement.

Do you think your melody is really guitarless? :D
[attach=1]

Anyway, I like it! I suggest inserting thirds when playing the tune for the second time. I mean, the original melody and thirds at the same time. Though, it would not be a 3 channel melody any more but it would be nice.
Title: Re: how to put a musicbox tune into program code?
Post by: geco on 2015.April.05. 16:30:01
Do you think your melody is really guitarless? :D
(Attachment Link)

Anyway, I like it! I suggest inserting thirds when playing the tune for the second time. I mean, the original melody and thirds at the same time. Though, it would not be a 3 channel melody any more but it would be nice.
The guitar sounds very goof in this song.
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.05. 17:52:27
The guitar sounds very goof in this song.
It was just FL Studio.
I am interested how it sounded originally, what ssr86 made about it. Do you really think it is not for guitar? Have you not thought of guitar sound with this song? I don't think so, it is absolutely a rock-like song. I think, it is great!
Title: Re: how to put a musicbox tune into program code?
Post by: nyuzga on 2015.April.05. 23:21:38
Cubase 5 Guitar song. :)
Title: Re: how to put a musicbox tune into program code?
Post by: geco on 2015.April.06. 18:25:40
It was just FL Studio.
I am interested how it sounded originally, what ssr86 made about it. Do you really think it is not for guitar? Have you not thought of guitar sound with this song? I don't think so, it is absolutely a rock-like song. I think, it is great!
I wanted to write good :)
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.07. 20:44:59
Ssr86's melody should sound in the Enterprise something like this:
[attachurl=1]

It was made by FL Studio, too. Drums aren't simulated.
A midi -> Enterprise converter would be appreciated. :D
Title: Re: how to put a musicbox tune into program code?
Post by: szipucsu on 2015.April.07. 20:54:15
And, this is a bit techno-like electronic remix: [attachurl=1]