Daqarta
Data AcQuisition And Real-Time Analysis
Scope - Spectrum - Spectrogram - Signal Generator
Software for Windows
Science with your Sound Card!
The following is from the Daqarta Help system:

Features:

Oscilloscope

Spectrum Analyzer

8-Channel
Signal Generator

(Absolutely FREE!)

Spectrogram

Pitch Tracker

Pitch-to-MIDI

DaqMusiq Generator
(Free Music... Forever!)

Engine Simulator

LCR Meter

Remote Operation

DC Measurements

True RMS Voltmeter

Sound Level Meter

Frequency Counter
    Period
    Event
    Spectral Event

    Temperature
    Pressure
    MHz Frequencies

Data Logger

Waveform Averager

Histogram

Post-Stimulus Time
Histogram (PSTH)

THD Meter

IMD Meter

Precision Phase Meter

Pulse Meter

Macro System

Multi-Trace Arrays

Trigger Controls

Auto-Calibration

Spectral Peak Track

Spectrum Limit Testing

Direct-to-Disk Recording

Accessibility

Applications:

Frequency response

Distortion measurement

Speech and music

Microphone calibration

Loudspeaker test

Auditory phenomena

Musical instrument tuning

Animal sound

Evoked potentials

Rotating machinery

Automotive

Product test

Contact us about
your application!

Txt2MIDI.DQM MIDI Setup

Introduction:

Txt2MIDI is a simple embodiment of the concept that since a spectrogram can display an image of an arbitrary sound, we can do the converse and construct a sound to produce an arbitrary image. In this case, the image is scrolling text; see the BMP Image to WAV Sound and Spectrogram Image macro mini-apps for full-color photographic images.

The Txt2MIDI.DQM setup converts an ordinary text message from the Daqarta Notes area into an array of MIDI notes that create a spectrogram banner of dot-matrix characters, scrolling the text message across the screen. You hear and see the message as a series of tone complexes, each defining one column of a dot-matrix character using up to 8 tones in a harmonic series. There are up to 8 columns per character. See the Operation topic below for images.

The scrolling message repeats indefinitely. You can change the message by editing the Notes text at any time; Txt2MIDI will begin showing the changed text after the current message completes.

If you save the .DQM setup, the new text will be saved with it and appear as the default the next time the setup is loaded.


Operation:

The simplest way to start Txt2MIDI.DQM is to run the DaqMusiq macro mini-app. Hit the F8 function key followed by the 'd' key, or hit CTRL+F8 to open the Macro Dialog and double-click on DaqMusiq in the Macro List. Then select Txt2MIDI from the Open dialog that appears.

The default text "DAQARTA!..." appears in the Daqarta Notes area, and also begins scrolling across the main display. However, the display defaults to Pitch Track mode instead of the normal Spectrogram, so the 8x8 dot-matrix characters are deformed due to the logarithmic musical note spacing; the higher rows of 'dots' will be crowded toward the top of the display, and the lower rows will be stretched out toward the bottom. In addition, the 'dots' will be stretched into lines that join all adjacent dots in each row of the character.

Daqarta's Volume dialog should be visible, so make sure that the sound is not muted and is at a comfortable level. (If the dialog isn't visible, hit the F9 function key.)

To see the dot-matrix spectrogram, first click 'OK' or [x] in the Pitch-to-MIDI dialog to return to the main Spectrogram / Pitch Track controls dialog. Click the Pitch Track button and the display will show mottled colors of random noise. (That's the noise source that is still driving the Pitch-to-MIDI script, even though Pitch Track is no longer active.)

Now toggle Input on. Here things may get tricky, depending on your sound card and Windows version. Open the Input controls dialog (thin unmarked button under Input in the toolbar).

On XP, toggle on the 'Stereo Mix', 'What You Hear', or possibly 'Synth' line or something similar, if present. If there is nothing appropriate, you will need to use a loopback connection to get the sound from the Output connector to the Line In (or possibly Mic In, if there is no Line In), and then select that in the Input dialog. Unfortunately, this will most likely mute your built-in speakers. If you have external speakers or headphones (that you had to disconnect to use the loopback), you may be able use a 'Y' connector at the output, with one arm going to the input and one to the speakers.

On Windows Vista and later the output sound is typically routed to the input by default, so you just need to toggle Input on.

Please note that some systems do not work with headphones when 'Stereo Mix' (or equivalent) is in use.

Once you can see text on the display, you will almost surely want to adjust the output volume or input level, along with the Spectrogram dB range, to get clean characters with no background noise, and to change the colors.

Use the PgUp/PgDn keys to change the dB range (shown to the right of the dB color bar at the right edge of the Spectrogram) to cover a larger (PgUp) or smaller (PgDn) range. Use SHIFT+PgUp to shift the range upward or SHIFT+PgDn to shift it down.

Here are two typical examples of colors:

You can also create a custom spectrogram palette for even more color options.

As noted in the Introduction, the scrolling message repeats indefinitely. If you edit the Daqarta Notes text, the changed text will start to appear after the prior message completes.

If you delete all the Daqarta Notes text (perhaps in the process of replacing it) such that the prior message ends without any new text available, the default will be a string of small ellipsis '(' characters until you enter new text.

By default the text characters use the full screen height, which allows about 3 characters at a time on the screen. As discussed under the Theory section, you can make them shorter by increasing the eXpand Max setting in the Spectrogram / Pitch Track controls dialog. You can make them narrower by increasing the Tempo at the top of the Pitch-to-MIDI dialog.


Melody Mode:

Optionally, you can change UM=0 at the start of the Voice 1 Changes Script to UM=1 to run Txt2MIDI in 'Melody' mode. In this mode, each character is assigned a random note from a selected Scale. Higher notes result in characters being displayed higher on the Spectrogram, and of course they have higher pitches as well.

A new Scale is randomly chosen at the start of each message repeat. The scales are from the GlossyScales set, selected for best results with GlossyTracks.DQM.

Since the notes are chosen from carefully selected scales, they sound better together than truly random notes. However, the 'Melody' designation belies the fact that there are no repeating themes or unifying patterns here; the result is merely more melodious than the default constant note scheme.


Theory:

The basic idea is that simple dot-matrix characters can be created by an 8x8 array of dots. For each character in the normal ASCII character set, there are 8 entries in the Documents - Daqarta - User_Data - Font8x8.TXT file. Each entry row is a binary value such that the '1' bits represent the dots that will appear in a column of that character. The first entry is the left-most column, and the last is the right-most. For example, the entry for the 'F' character is:

    ;Char 70 'F'
    b10000010          ;1st column, serifs
    b11111110          ;2 vertical bars
    b11111110
    b10010010          ;Start of top and center, bottom serif
    b10111000          ;End of center, with serif
    b10000000          ;Top continuation
    b11000000          ;End of top, with serif
    b00000000          ;8th column, spacer

To "read" this by eye, you need to mentally flip the rows and columns (omitting the leading 'b' for 'binary'). The flipped array and the resulting character are shown below:

    11111110        OOOOOOO
    01100010         OO   O
    01101000         OO O
    01111000         OOOO
    01101000         OO O
    01100000         OO
    11100000        OOO
    00000000

To create each 'dot' in the eventual spectrogram, we need to turn on a pure tone for a short period of time. The frequency of the tone determines the vertical position, while the duration of the tone determines the width of the dot.

Since the dot-matrix font can have up to 8 dots in one column, we need to produce up to 8 different tones simultaneously. To get equal vertical spacing between the dots, the tones must be equally spaced in frequency. To also get a pleasing sound, we can make the tones fall on the frequencies of a harmonic series (integer multiples of a common fundamental).

Unfortunately, MIDI is based on musical notes which have specific logarithmically spaced frequencies. By careful selection of MIDI notes, however, we can get quite close to the desired harmonic spacing.

Since Daqarta's Pitch-to-MIDI system has 8 separate Voices, we can use Voice 1 for the fundamental at 110 Hz (A2), up to Voice 8 for the 8th harmonic at 880 Hz (A5). (See Standard Musical Note Frequencies for a list of names and frequencies of all 88 notes on a piano keyboard.)

The note frequencies are pre-set via the Pattern Key of each voice. Here is the complete list:

   Voice    Note     Freq Hz      Ratio
     1       A2      110.000      1.000 (Fundamental)
     2       A3      220.000      2.000 (Octave)
     3       E4      329.628      2.997
     4       A4      440.000      4.000
     5       C#5     554.365      5.040
     6       E5      659.255      5.993
     7       G5      783.991      7.127
     8       A5      880.000      8.000

Voice 7 is 1.8 percent higher than the desired 770 Hz. This is nearly a 3rd of a semitone, but it's the best we can do with standard notes. This error is too small to see on a spectrogram whose vertical scale is set to show the whole series. It is audible, but not objectionable. (See MissFundamental.DQM MIDI Setup for details.)

All 8 voices are set to Ocarina (Instrument number 79). This instrument is the best approximation to a pure sine wave among the General MIDI Instruments in the standard Microsoft GS Wavetable synthesizer.

The Tempo defaults to 300 BPM (Beats Per Minute), which gives about 3 full-height characters per screen with the default spectrogram vertical range. Increasing the tempo to 600 or 1200 BPM will produce narrower characters to get 6 or 12 per screen, but with taller aspect ratio. You can restore the original aspect ratio by increasing the eXpand Max setting by a factor of 2 or 4, but then the characters will be only one half or one fourth as tall.


Voice 1 Changes Script:

UM=0                    ;Melody off
[UM=1                   ;Melody mode?
    Qm=2578.235             ;Higher eXpand limit if so
| Qm=984.375 ]          ;Else lower limit, larger chars
GXt=1                   ;Xpand on
GPT=0                   ;Pitch Track off
GXM=Qm                  ;eXpand Max, normal Sgram
GXm=46.875              ;eXpand Min, normal Sgram
GPT=1                   ;Pitch Track on
GXM=Qm                  ;eXpand Max, Pitch Track
GXm=93.75               ;eXpand Min, Pitch Track
BLm0="..Font8x8"       ;Load 8x8 dot-matrix font
BLm2="GlossyScales"     ;Load Scale list for Melody mode
US=BLm2                 ;Number of entries in Scale list

{!                      ;Infinite loop
[UM=1                   ;Melody mode?
    S9=Bm2.?(0,US-1)        ;Load same random Scale to all 8 voices
    oRS=S1                  ;Show Scale number
    ors=S1                  ;Show Scale note map
] 

BLm1="<NoteS"           ;Load current Daqarta Notes string
QA=BLm1                 ;Number of chars in string
Q0=0                    ;Character index in string
{QA                     ;Do all chars
QC=Bm1.Q0               ;Get ASCII char value at this Q0 index
[UM=0                   ;If not Melody mode,
    n9=0                    ;Set +/-Note to 0 for all voices
| n9=?(0,12)]           ;Else set to random Scale note in octave
U8=0                    ;Column counter
{8                      ;Do all 8 columns for char
    UA=Bm0.8*QC+U8          ;Current column byte for char
    X1=UA&1                 ;Voice 1 on if 1s bit set
    X2=UA&2                 ;Voice 2 on if 2s bit set
    X3=UA&4
    X4=UA&8
    X5=UA&16
    X6=UA&32
    X7=UA&64
    X8=UA&128
    W=1                     ;Wait 1 beat, mandatory loop delay
    U8=U8+1                 ;Next column index for this char
}                       ;Next column
X9=0                    ;All voices off between chars
W=1                     ;Wait 1 beat, mandatory loop delay
Q0=Q0+1                 ;Next character index in Notes string
}                      ;Next character
}                      ;Repeat infinite loop
0

See also Example MIDI Setup Files, MIDI Setup Files, Musical Frontiers, DaqMusiq, KaleidoSynth, Pitch-to-MIDI dialog, Pitch Track Toolbox - Overview, Spectrogram / Pitch Track Controls, Spectrogram / Pitch Track (Sgram/PT)

GO:

Questions? Comments? Contact us!

We respond to ALL inquiries, typically within 24 hrs.
INTERSTELLAR RESEARCH:
Over 30 Years of Innovative Instrumentation
© Copyright 2007 - 2017 by Interstellar Research
All rights reserved