user1499: I tried to experiment with the tone() function that comes with the arduino library.
I played around with the standard code example located here:
https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody
This is the code:
#include "pitches.h"

int melody[] =
{
  NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4
};

int noteDurations[] =
{
  4, 8, 8, 4, 4, 4, 4, 4
};

void setup()
{
   for (int thisNote = 0; thisNote < 8; thisNote++)
   {
      int noteDuration = 1000 / noteDurations[thisNote];
      tone(8, melody[thisNote], noteDuration);
 
      // to distinguish the notes, set a minimum time between them.
      // the note's duration + 30% seems to work well:
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);

      // stop the tone playing:
      noTone(8);

   }
}

void loop()
{
  // no need to repeat the melody.
}

However, the problem is that there is always a pause between notes.
In musical terms, this is called staccato.
I want to be able to play short melodies where there are no delays between the notes, and one note progresses to the next naturally. By the way, this is called legato in music theory.
Now, in this example, the delay between the notes sounds good because this "music piece" is supposed to be played this way. But in every other song that i experimented with, there were always some pauses between notes.
This is what this song sounds like: https://soundcloud.com/nikowow-1/normal
Naturally, my mind went to the delay(pauseBetweenNotes) function. So i thought this is what causes the delay between the notes. So i set it up to 0.5. This is what it sounds like: https://soundcloud.com/nikowow-1/05a
As you can hear, it just speeds up the whole song. The delay between the notes remain, but the whole song is sped up (in a higher tempo, so to speak).
In order to better hear the delay between the notes, please take a listen at the song when i selected a value of 3 - causing a smaller tempo, so that the delay between the notes can be more easily audible: https://soundcloud.com/nikowow-1/3a-1
I want to create some melodies where there are no delays between the notes and i am stuck.
EDIT: If you remove the delay line alltogether, the song is played so quickly that only a click sound is heard.

user37622: there is
      // to distinguish the notes, set a minimum time between them.
      // the note's duration + 30% seems to work well:
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);

so the *1.30 creates the pause.
if you change it to
   int pauseBetweenNotes = noteDuration;

there will be no pause between notes.
The tone length is specified with the last parameter of the tone() function (noteDuration here).

1499: <p>I tried to experiment with the <code>tone()</code> function that comes with the arduino library.</p>
<p>I played around with the standard code example located here:
<a href="https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody" rel="nofollow noreferrer">https://www.arduino.cc/en/Tutorial/BuiltInExamples/toneMelody</a></p>
<p>This is the code:</p>
<pre><code>#include &quot;pitches.h&quot;

int melody[] =
{
  NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3, 0, NOTE_B3, NOTE_C4
};

int noteDurations[] =
{
  4, 8, 8, 4, 4, 4, 4, 4
};

void setup()
{
   for (int thisNote = 0; thisNote &lt; 8; thisNote++)
   {
      int noteDuration = 1000 / noteDurations[thisNote];
      tone(8, melody[thisNote], noteDuration);
 
      // to distinguish the notes, set a minimum time between them.
      // the note's duration + 30% seems to work well:
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);

      // stop the tone playing:
      noTone(8);

   }
}

void loop()
{
  // no need to repeat the melody.
}
</code></pre>
<p>However, the problem is that there is always a pause between notes.
In musical terms, this is called <code>staccato</code>.
I want to be able to play short melodies where there are no delays between the notes, and one note progresses to the next naturally. By the way, this is called <code>legato</code> in music theory.</p>
<p>Now, in this example, the delay between the notes sounds good because this &quot;music piece&quot; is supposed to be played this way. But in every other song that i experimented with, there were always some pauses between notes.</p>
<p>This is what this song sounds like: <a href="https://soundcloud.com/nikowow-1/normal" rel="nofollow noreferrer">https://soundcloud.com/nikowow-1/normal</a></p>
<p>Naturally, my mind went to the <code>delay(pauseBetweenNotes)</code> function. So i thought this is what causes the delay between the notes. So i set it up to <code>0.5</code>. This is what it sounds like: <a href="https://soundcloud.com/nikowow-1/05a" rel="nofollow noreferrer">https://soundcloud.com/nikowow-1/05a</a></p>
<p>As you can hear, it just speeds up the whole song. The delay between the notes remain, but the whole song is sped up (in a higher tempo, so to speak).</p>
<p>In order to better hear the delay between the notes, please take a listen at the song when i selected a value of <code>3</code> - causing a smaller tempo, so that the delay between the notes can be more easily audible: <a href="https://soundcloud.com/nikowow-1/3a-1" rel="nofollow noreferrer">https://soundcloud.com/nikowow-1/3a-1</a></p>
<p>I want to create some melodies where there are no delays between the notes and i am stuck.</p>
<p>EDIT: If you remove the delay line alltogether, the song is played so quickly that only a click sound is heard.</p>
 37622: <p>there is</p>
<pre><code>      // to distinguish the notes, set a minimum time between them.
      // the note's duration + 30% seems to work well:
      int pauseBetweenNotes = noteDuration * 1.30;
      delay(pauseBetweenNotes);
</code></pre>
<p>so the *1.30 creates the pause.</p>
<p>if you change it to</p>
<pre><code>   int pauseBetweenNotes = noteDuration;
</code></pre>
<p>there will be no pause between notes.</p>
<p>The tone length is specified with the last parameter of the tone() function (<code>noteDuration</code> here).</p>
