Ejemplo n.º 1
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            // set title
            this.Text = "Wav2Zebra2Osc Version " + VERSION;

            // Initialize Bass
            audioSystem = BassProxy.Instance;

            // Ensure the paint methods are called if resized
            ResizeRedraw = true;

            // Initialize the wave display cells
            waveDisplays = new WaveDisplayUserControl[16];
            int counter = 0;

            for (int row = 0; row != 4; ++row)
            {
                for (int col = 0; col != 4; ++col)
                {
                    this.waveDisplays[counter] = new WaveDisplayUserControl(this);
                    this.tableLayoutPanel.Controls.Add(waveDisplays[counter], col, row);
                    this.waveDisplays[counter].ResumeLayout(false);
                    this.waveDisplays[counter].PerformLayout();
                    counter++;
                }
            }
            this.waveDisplays[0].Selected = true;

            // Initalize the jagged data arrays
            this.soundData   = MathUtils.CreateJaggedArray <float[][]>(16, 128);
            this.morphedData = MathUtils.CreateJaggedArray <float[][]>(16, 128);

            // generate the sine data
            this.sineData = OscillatorGenerator.Sine();

            // set sine data to first and last element
            Array.Copy(this.sineData, 0, this.morphedData[0], 0, 128);
            Array.Copy(this.sineData, 0, this.morphedData[15], 0, 128);

            this.waveDisplays[0].Loaded       = true;
            this.waveDisplays[15].Loaded      = true;
            this.waveDisplays[0].MorphedData  = this.morphedData[0];
            this.waveDisplays[15].MorphedData = this.morphedData[15];
            this.waveDisplays[0].Refresh();
            this.waveDisplays[15].Refresh();

            this.OutputText = "Export path: " + ReadExportPathName();
        }
Ejemplo n.º 2
0
        public static bool ConvertMassiveDirectory(string inputDirectory, string outputDirectory)
        {
            // init the audio system
            var audioSystem = BassProxy.Instance;

            // generate the sine data (used for zebra morphing)
            var sineData = OscillatorGenerator.Sine();

            string massiveWavetablesPath = Path.Combine(inputDirectory, "wt");

            if (Directory.Exists(massiveWavetablesPath))
            {
                var map = MassiveMapping.ReadMassiveMapping("massive_map.csv");

                // find all the wtinfo.txt text files
                var files = IOUtils.GetFilesRecursive(massiveWavetablesPath, "wtinfo.txt");
                foreach (var file in files)
                {
                    int singleCycleLength = ReadSingleCycleLength(file);
                    if (singleCycleLength > 0)
                    {
                        // find associated wave files
                        string dirPath  = Path.GetDirectoryName(file);
                        var    wavFiles = IOUtils.GetFilesRecursive(dirPath, "*.wav");

                        // how to deal with more than one wave?
                        // that doesn't seem to happen - so we are fine!
                        int count = 0;
                        foreach (var wavFile in wavFiles)
                        {
                            SplitIntoSingleCycleWaveforms(inputDirectory, wavFile, singleCycleLength, map, outputDirectory, sineData);
                            if (count > 0)
                            {
                                Console.Out.WriteLine("Wops, I don't think this is supposed to happen.");
                            }
                            count++;
                        }
                    }
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
 void TriangleSawToolStripMenuItemClick(object sender, EventArgs e)
 {
     SetOscillator(OscillatorGenerator.TriangleSaw(), "TriangleSaw");
 }
Ejemplo n.º 4
0
 void PulseHighLowIIToolStripMenuItemClick(object sender, EventArgs e)
 {
     SetOscillator(OscillatorGenerator.PulseHighLowII(), "PulseHighLowII");
 }
Ejemplo n.º 5
0
 void SquareHighLowToolStripMenuItemClick(object sender, EventArgs e)
 {
     SetOscillator(OscillatorGenerator.SquareHighLow(), "SquareHighLow");
 }
Ejemplo n.º 6
0
 void SawFallingToolStripMenuItemClick(object sender, EventArgs e)
 {
     SetOscillator(OscillatorGenerator.SawFalling(), "SawFalling");
 }
Ejemplo n.º 7
0
 void SineToolStripMenuItemClick(object sender, EventArgs e)
 {
     SetOscillator(OscillatorGenerator.Sine(), "Sine");
 }