Simple machine to make your own music in Factorio like a beatmaker

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

I love listening to music, but i'm not talented at making music. I like trying anyway :) This creation is adapted for beginners, i have no idea how to improve it to suit better musicians but any suggestion would be appreciated. For now i think i found an approach that makes it easy for anyone like me to use just a few combinators and start making some music and experimenting with beats and rythm. The "how it works" is not that hard but the explanation is long because there's many simple things together, the "how to use" is shorter and easier :).
The simple
minimalist.jpg
minimalist.jpg (172.69 KiB) Viewed 3075 times
Rock demo minimalist :
How it works

I'm not joking only 4 combinators matters here ! Let's address the 64 that do not really matter here, they are just here to give a number to the lamps. There are 64 of them, that's the number written in the combinator (4), the first arithmetic combinator of the long 64 array remove 1 to this number, so the last lamp is lamp number "63", and the lamp before 62, 61, 60 , 59, 58 ... and the first lamp is 0.

64 is a magic number here , because it divide in 8 twice, it makes it easy to do rythm in factorio, the red belts represent the subdivisions, and the lamp the smaller subdivisions of time, this is supposed to be similar to music software/ sequencer, there are plenty videos online on how to make sequences ( for beginners ) that start with this one so i did the same, but later we'll see how to expand.

This is like a track that will be played in a loop, each lamp has its number making it possible to place a speaker with the same condition as the lamp, and the sound will be played at the proper time and repeat, boom tac boum tac, boom tac boum tac :) I added some constant combinators next to the speakers to make it easy to copy paste the wiring, and to help as an intermediate subdivision of time to place the beat like they show in videos teaching how to make beats.

The missing piece of logic is how to choose the tempo, the number of beat per minutes, that's usually what need to be setup first, i think, they always start by that on videos, they never say it at the end, like if they didn't say at the beginning you are supposed to know or look it up. It's quite easy to find the BPM for a song, but in factorio the question is : how much time a lamp need to be lit before the next lamp lit ?

That's easy and not easy, in the example, in the arithmetic combinator (1), you divide "T" by 225 , the decider combinator (2) only let "T" goes through if "T" is less or equal to 14175 and the 3rd constant combinator hold the value of "T" = 80. That's the easy part.

What happens : the constant combinator holding the value 80 will pass 80 to the second combinator, the decider looping "80" onto itself, 80 160 240 320 400 480 .... until it reaches 14175 and repeat, that's how we make the time loop.

This number that will increase is divided by 225, and 14175/225 = 63 That's like a 64, because first lamp is number 0, and we have 64 lamps, so the last one is 63. That's very convenient :). This means when the time will pass and the music player is on, it will count up to 14175, at speed of 80 per tick, it will take approximately 177 ticks or 2.95 seconds to lit all the lamps and restart.

And the BPM in all that ? well it depend on how the subdivision are used, if a "kick" from the speaker is placed at every first red belts, this means there will 8 beats in 2.95 seconds, or (60/2.95)*8 = 162 BPM. This is not what i have done in the example, instead i only placed a beat on half of the red belts. This means the BPM is actually around 80, which was the recommended for this drum pattern in the video. This means there are 16 lamps between 2 beats to attach a sound, it's rigid a sound can't be played in between, it sound robotic for this, but each sound can be given a little accent since they have each their independant speaker.

That's a lot of text and a lot of math, it sounds like annoying to do that all time, so i made another version, with a bit more combinators to make things easier to use :
The automated
expandable.jpg
expandable.jpg (145.79 KiB) Viewed 3075 times
Bo Diddley demo :

How to use
This one can be expanded(or shortened) by copy pasting more lamps on the left with overlapping blueprint ( easier to add 8 lamps when copy pasting 16 ) for belts to match. It uses the constant combinators under the lamps for both easy wiring of the speaker, and counting the lamps for the machine to update itself after a change. There are more belts to help count and vizualize time. There is only 1 place for setting, that is the right most constant combinator. It only has 2 value "T" and "D" , increasing T or decreasing D will make the song faster, decreasing T or increasing D will make the song slower.

To make music, change the speakers positions and sound :)
How do i export my mixtape ?
Tiny Rock box.jpg
Tiny Rock box.jpg (75.65 KiB) Viewed 3075 times
Tiny Rock box demo :


This is an example of manual compression process :), from the simple rock box version, there are only 3 differents sounds, a kick a a snare and a hi hat, but sometimes sound are played so close to each other that the second one can't be heard, and if using "allow polyphony" it can happen that the music is too slow and 1 speaker will play twice its sound. Apart from that, it is possible to write the position of the notes, that's just a number from 0 to 63. The kick exist at position 1, 33 and 37, in the simple version, but 33 and 37 is too close for this tempo. So it is made into 2 speaker, one only for position 33 and one for 1 and 37. The clock is the same, there is just no more array of lamps and combinators, instead it's just 1 combinator per speaker, that will check if the constant combinator next to it contain "any" signal that would match the current lamp that would be lit, if there were lamps.
The hi hat had the same process, but since it is repeating on every single half note, it is possible to use the current count of position, and do modulo 16 this will create a clock that count from 0 to 15, and the hi hat speakers are made to produce sound when the count is 0 or 8.

The compression process at the end is not necessary to have some fun here are some creations that were made on the simple machine before i thought of making it easier to use:

"funk demo"


Trap (music) with the simple machine too:


Hip hop also the old machine :


Disclaimer : all the speakers will produce a sound during 1 tick when copy pasted, it's loud !
Illiander42
Filter Inserter
Filter Inserter
Posts: 521
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by Illiander42 »

You might be interested in miditorio: https://miditorio.com/
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

Illiander42 wrote: Sun Mar 31, 2024 9:32 am You might be interested in miditorio: https://miditorio.com/
Yes, i saw your suggestion to add more notes to the speaker, and that was kind of a revelation x) , i have many music boxes from this website found over the internet and multiplayer games over time but i didn't realized they came from that website.

It's more complex to understand than the machine i did but the concept is similar, it's time and moment in time when sound are called, but with the addition of choosing the proper tone for the note, which is outside of my skillset, i am already happy when the rythm sounds good. The way the notes and timing are encoded is a little different, more efficient, using the binary representation of a 32 bit number to represent 32 lamps if that can be compared. The "when" a sound is played depend on which bit is flipped "on" or "off" in a number.

Instead of writing "3" for the third position as i did in the manual compression process, it would be on a blueprint from MIDItorio something like "8", which is (100) in binary, this way when writing "9"(101), it is possible to play a note twice in first and third position whereas in the system i used, to play a note twice, it would be necessary to write "1" and "3", redundant, or use a system like for the hi hats, low flexibility.

It's good when importing whole midisequence but it makes it difficult to make your own sound because the data are compressed in the machine, so editing it to change the sound is not intuitive, whereas i tried to make a machine that would allow me (or other people with very little music production capacity) to follow online video to make music by themselves :)

I followed this explanations for the "Rock" demo at first, and tried to do the others, there is the picture of where to place the speakers and which sound to call :) Once i made them all i felt confident into trying some more, and went for this video Where i learned the name of the Bo Diddley, and found it was easy to follow the pattern at the bottom of the screen, good pace, and for beginners :)

I have made others , they are not compressed so can be used as demo or modified :


Drum n Bass :




4 on the Floor :


Dem Bow :


House music :
Illiander42
Filter Inserter
Filter Inserter
Posts: 521
Joined: Mon Feb 05, 2018 10:01 am
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by Illiander42 »

The "use signal as tone" on the speaker is just doing an array lookup on the instrument. It's not doing anything clever.

As for MIDITorio, it's got a nice compact memory decoder, and it generates the huge memory cells for you.

It doesn't do memory compression though. Just concatination (storing 4 8-bit integers in a single factorio signal, etc...). Compression would be impressive, but probably more overhead than is worthwhile.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

Illiander42 wrote: Sun Mar 31, 2024 7:51 pm The "use signal as tone" on the speaker is just doing an array lookup on the instrument. It's not doing anything clever.
That answers my hypothesis, i thought it could be somehow to choose the frequency of the vibration but nope. In any case, i can't choose properly the notes like F3 or F2 or D3 or C4, the technical side is not the biggest hurdle here , more like the musical side , for now it feel like placing random building from the inventory and hoping to get science done. But there also tutorial for noobs on that, so maybe later i will make my own melody too :).
Illiander42 wrote: Sun Mar 31, 2024 7:51 pm As for MIDITorio, it's got a nice compact memory decoder, and it generates the huge memory cells for you.
It doesn't do memory compression though. Just concatination (storing 4 8-bit integers in a single factorio signal, etc...). Compression would be impressive, but probably more overhead than is worthwhile.
The concatination is already a more efficient/compressed way than how i'm storing the data i think. I could try and make the tiny box even tinier maybe. I thought of making a juke box too, with the radars using wireless transmission, one could have some music box in a corner of the factory, and when wanting some music, build another radar, send a code from it and remove it, and it would call the juke box to play the music for a while, or a specified amount of time in the code. I thought with the expansion it will even be possible to recycle item, to make it like the juke box need some iron plate or maybe coins to play a sound and it would "eat" them like juke box do. That wouldn't be wireless though.

I have looked at the mod musical speaker fixed too, but many of the sounds aren't on the portal which makes it harder to share creations. Though it present an additionnal interesting challenge, as you also have to specify how many ticks the sound will be playing, otherwise it's 1 tick or the length of the sound, but it's often necessary to have it last a certain amount of time so it finishes before the next one start like 7 or 12 ticks. And the condition can only be "anything >0". Found ways to do so, but not the best atm and the sound i attempted are not satisfying. It does open up some advanced techniques though, with little random offset in time of a tick or two so that it doesn't repeat exactly the same, or changing attack to make the sound start soft or end soft, because there is volume control signal. But i practiced the basic instead.

Here are some other beats made from following videos :

Impeach the president :


Iconic 8 :



12/8 :


Boom Bap :
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

I made some other rythms from following videos, and experimenting for practice and because it was fun, not much to show but here are the blueprints anyway :

"Funky" personnal creation derived from the earlier "Funk" demo :


Shuffle ( a classic Rock from videos ) :



Dilla Beat from lo-fi tutorial videos :


Dilla beat, personnal sped up mix :


Affection groove, from lofi video tutorial :


Straight and Swung from following online videos :


Soul vibes from following tutorial videos :
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

I did not realized i did that many here are some more :

Slow Jam from following online tutorial :


ABAC ( rock) from following tutorial video :



Ghost Jam from following tutorial video :


This one is a personnal mix with in game alert sound added to the funky rythm and a few bass notes randomly generated to complete :


This one is different it's compressed tiny box version for ambiant sound : grasshoper as heard from the window of a train in summer :
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

This one is personnal creation inspired by Aaron by paul Kalkebrenner it didn't fit in previous post:


That was not the correct blueprint ... now fixed
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

I have been learning how to read drum partition from tutorial videos.

Doing so i felt compelled to change the machine a little and tried to streamline the process a bit , it look like this :
1 second kick pulse.jpg
1 second kick pulse.jpg (543.8 KiB) Viewed 2664 times

It can be expanded to the right side like in those shown in the FFF, and pretty much everywhere else too, unlike my previous versions that were expanding to the left side , sorry.

It "knows" how many lamps are there when expanding, it tells how many ticks it will take for the combinators to loop around the sequence.
The "spacing between kicks" setting is meant to be manually changed depending on how many tiles there are between substations, and how many kicks in such division. In the example, there are 8 tiles between substations, and a kick in every subdividision, but no more. This means the machine know how many "beat" per sequence, since it also knows the number of lamps ( 32 /8 = 4 ), it knows a sequence is 240 ticks long ( 4 seconds), so it can tell there will be 1 kick per second, or rather 60 bpm.

Nixie tubes and letters are not necessary for the machine to work, they are just helpful for adjusting the constant combinator with the signal[T] and the signal B.
Every tick, "T" is added to the counter, which is divided by "B"times the number of lamps. This gives the value "M". It will reset when "M" has reach the number of lamps.
In other words, T/B define how fast/slow the next lamp lit up.
In the example T= 160, B= 1200 and there are 32 lamps, this means the counter can go up to 1200*32 before resetting, that is 38400. Every tick T is added to the counter, in order to reach 38400, it will require 38400/160 ticks. That is 240 ticks, the "tick sequence".

Since there are 32/8=4 kicks in 240 ticks, that also means 60 ticks between each kicks. So 1 second. This is a clock. But between each lamp there is 60/8 ticks or 7.5 ticks. This means sometimes 7 sometimes 8, as the duration during which the lamp is lit. This can be dealt with by halving the number of lamps, and/or adapting T and B, if 1/60th of a second of delay is noticeable for a certain rythm which can happen when the tempo is fast.

The group of 4 combinator on the left side is only used for the lamps display and calculation and as such can be removed to make compressed version. Here is how it look like on the example:
small clock.jpg
small clock.jpg (92.98 KiB) Viewed 2664 times


The clock and mechanism to play/pause is still there. But instead of the array of lamps, there is an arithmetic combinator doing modulo 8 operation. so "M" instead of going from 1 to 32 goes from 0 to 7 and loop. The number "32" instead is written for the signal "U" in the constant combinator that turn on/off the machine. It also hold 1 signal M, so when it is turned on M will count from 1 to 8 and loop around. This allow to configure speaker to ring when M = 1 and not M= 0.


Here is another example from the video :
Syncopated Groove Level 1.jpg
Syncopated Groove Level 1.jpg (768.37 KiB) Viewed 2664 times


It look like the music sheet to me, the hi hat are placed on the upper lane, the snare in the middle and the kick at the bottom on the sheet from what i could hear and that correspond to the position of the speakers. This beat is just the level 1, but it shows how to setup the clock to a different tempo and the relation with the music sheet in the video.

Its tiny version look like this :
Sycopated Groove Level 1-tiny.jpg
Sycopated Groove Level 1-tiny.jpg (126.4 KiB) Viewed 2664 times


This time there are 3 arithmetic combinators, 2 are still doing modulo operation, 16 or 8, one for the hi hats that are occuring more often than the other for the kick and snare. And there is one dummy arithmetic for that particular kick at lamp 25 which is occuring once every 32 lamp, it does nothing but adding a delay to match the other speakers.

Once this was setup it was possible to continue doing the different rythm in the videos :

SKDG level 2 :


And its tiny version :



SKDG level 3 :


SKDG lvl 4 :


SKDG lvl 5 :


SKDG level 6 :
Last edited by mmmPI on Fri Apr 19, 2024 1:06 pm, edited 1 time in total.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

SKDG level 7 :



SKDG level 8 :


SKDG level 9 :


There was 9 in this videos. With the same tempo. There are quite simple rythm with only few variations between them, more like exercice, it allows to understand the more difficult one though, starting with only few things. Other more complicated rythm includes more subtle time division, additionnal sounds, different volume for speakers , different sounds played at the same time and others i couldn't understand yet, or that one can't replicate in factorio (yet?) , specifically, when the drummer stop a sound from playing by touching the cymbal for example or extend its duration with the pedal. The snare don't always sound the same and so on ...

This machine was made to be easy to start using and configure, to add speakers it's possible to copy them with the upper constant combinator to which they are attached, to avoid having to wire or set condition on them. The second row of constant combinator can be removed or used to attach other speaker, for melody instruments or to keep track of modifications for 2 version of the same base.
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

Syncopated Kick Drum Groove tiny version collection :

SKDG level 3 tiny :


SKDG level 4 tiny :


SKDG level 5 tiny :


SKDG level 6 tiny :


SKDG level 7 tiny :


SKDG level 8 tiny :


SKDG level 9 tiny :



Larger blueprint showcasing a train looping around 3 station, 2 of them being attached to tiny music box that play only when the train is there :



This shows how to add trigger condition to the other rythm box, or how to make a train based juke box or a musical journey whatever x)
mmmPI
Smart Inserter
Smart Inserter
Posts: 3644
Joined: Mon Jun 20, 2016 6:10 pm
Contact:

Re: Simple machine to make your own music in Factorio like a beatmaker

Post by mmmPI »

With the 2.0 combinators, there's some new possibilities to write the music using less combinators. I have reworked a clock to use the new [red]*[green] operation allowed now, and changing a bit the system for the instruments, in the following example 1 decider combinator is used per instrument for starter, and each moment when they should play is hardcoded in the decided combinator which act as the support for writing the beat.

I said for starter because it's still not using the polyphony, and as such require one speaker to fully play a sound before starting the next one, and since the cowbell sample are "long" compared to the frequency at which they should bbe played in the beat , there are 3 speaker for them. Same for "percu 1" using a slighlt different way of doing.

Using the new display pannel and the possibility to add descriptions to combinators, i think it makes it easier to understand the already quite simple music box.

It look like this :
funkybox.jpg
funkybox.jpg (136.05 KiB) Viewed 506 times


You can paste this and turn on the constant combinator "BTU" on the left to turn on/off the funk while reading the notes of each combinators.
Post Reply

Return to “Combinator Creations”