Skip to content

Commit 8da4ff1

Browse files
committed
v0.51 alpha
Readded a button for linear shifting to make it a little bit easier for the end user. They would have had to make sure that it's being shifted with order 0 to do linear shifting but now it's just a nice little button
1 parent 621c6bc commit 8da4ff1

File tree

6 files changed

+24
-36
lines changed

6 files changed

+24
-36
lines changed

dev notes/9.19.20 v0.5-alpha release.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.5 Alpha is out :)The design I ended up settling upon was a user controlled raised cosine window. The user can control the order and attenuation of the cosine. The way it works is like this. center_freq = midpoint between lower and higher window freq indicesif shifting freq up, the shifting index modulation is x[n] = cos(w*(n-center_freq))^order if lower_index <= n <= fftSize , 0 otherwiseif shifting downx[n] = cos(w*(n-center_freq))^order if 0 <= n <= higher_index , 0 otherwisew is calculated given the attenuation the user selects. The ideal is to havex[higher_index] and x[lower_index] = attenuation, or cos(w*(higher_index-center_freq)) = (attenuation)^(1/order) w = acos(attenuation^(1/order))/(higher_index-center_freq)and then lastly, shift_map[n] = shift_index*x[n]x[n] simply provides a modulation on how far things get shiftedThis way the user can control how much frequencies beyond the window shift. Lower order / higher attenuation will mean that more values beyond the window will shift.

dev notes/TODO list.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
S+ Features TODO listSpectrogram Plus Resonance Processing Tools. Aka Spec+, S+, S++, etcI'm not a name designer okStage 1:* Implement basic frequency dependent frequency shifters * See: NLFS brainstorming* Make the GUI for the frequency shifter windows-> Prototyping / Alpha build ETA: 1 weekStage 2:* Study more signal processing concepts, especially in regards to selective frequency shifting * Study more voice mechanics to make sure I know exactly what different resonant shifts do * Make a general map relating resonant shifts with the accompanied sound * Come up with different types of audio filters that would accompany those shifts* Perform testing on audio input and output * Will need to collect audio samples / create audio samples for test cases * How will these tests be evaluated? * Objective Test: Calculate if the filter works *as intended* * Does it shift it where I wanted it to? Like does the calc work * But even if filter works as intended, we have to most likely be purely subjective about how it sounds, especially in regards to audio. The goal is to produce specific sound shifts from the filtering. * But we can be somewhat objective about that, especially by noting the changes across a wide variety of audio samples to determine if it achieves the desired output. * Diagnose issues, fix issues, iterate-> Beta ETA free time dependentFinal Stage:* Refine GUI + reevaluate project needs* Think about how I want to incorporate the vocal technique -> resonant shift map * Decide if worth implementing before 1.0 or save that for the next ver.-> Initial Version Release (1.0) General notes: * Consider parallelization of ISTFT and STFT if needed for real time calculation. Currently leaving real time calculation to Spectrogram so not necessary atm* Consider changing the name of FFTs to STFT. While the structure is technically a collection of FFTs and the data used to create the FFTs, hence, FFTs, it is much more accurately a Short Time Fourier Transform of a signal.* Consider deprecating Spectrogram.cs and moving to my custom FFTs class
1+
S+ Features TODO listSpectrogram Plus Resonance Processing Tools. Aka Spec+, S+, S++, etcAlpha build out! v0.5-alpha. Stage 1 done :^)Stage 2:* Perform testing on audio input and output * Mostly by ear sounding for now * Do shifted resonances produce natural sounds? * If not, how can I improve on my shifting to make it sound more natural? * Study more voice mechanics to make sure I know exactly what different resonant shifts do * Make a general map relating resonant shifts with the accompanied sound * Come up with different types of audio filters that would accompany those shifts-> Beta ETA free time dependentFinal Stage:* Refine GUI + reevaluate project needs* Think about how I want to incorporate the vocal technique -> resonant shift map * Decide if worth implementing before 1.0 or save that for the next ver.-> Initial Version Release (1.0) General notes: * Consider parallelization of ISTFT and STFT if needed for real time calculation. Currently leaving real time calculation to Spectrogram so not necessary atm* Consider changing the name of FFTs to STFT. While the structure is technically a collection of FFTs and the data used to create the FFTs, hence, FFTs, it is much more accurately a Short Time Fourier Transform of a signal.* Consider deprecating Spectrogram.cs and moving to my custom FFTs class

src/Windows/Audio Processing Windows/FrequencyShifterWindow.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
xmlns:local="clr-namespace:SpecPlus.Windows"
77
mc:Ignorable="d"
88
Title="FrequencyDependentShifterWindow"
9-
Height="210" Width="250"
9+
Height="245" Width="250"
1010
ResizeMode="NoResize">
1111
<Grid x:Name="FrequencyDependentShifterGrid">
1212
<Grid.RowDefinitions>
1313
<RowDefinition Height="10"/>
1414
<RowDefinition Height="auto"/>
15+
<RowDefinition Height="auto"/>
1516
<RowDefinition Height="1*"/>
1617
</Grid.RowDefinitions>
1718
<Grid.ColumnDefinitions>
@@ -45,5 +46,7 @@
4546
</Grid>
4647
<Button x:Name="ButtonApplyToWindow" Click="ButtonApplyToWindow_Click"
4748
Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,0,10,20" Content="Apply to Window"/>
49+
<Button x:Name="ButtonShiftAll" Click="ButtonShiftAll_Click"
50+
Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Margin="0,0,10,20" Content="Linear shift all"/>
4851
</Grid>
4952
</Window>

src/Windows/Audio Processing Windows/FrequencyShifterWindow.xaml.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,7 @@ private void ButtonApplyToWindow_Click(object sender, RoutedEventArgs e)
5252
order: (int)SliderOrder.Value, thresh: SliderThreshold.Value);
5353
}
5454

55+
private void ButtonShiftAll_Click(object sender, RoutedEventArgs e)=>
56+
AudioAnalysis.Processing.FrequencyShifter(parentRef.GetSTFT(), (int)SliderFreqShift.Value);
5557
}
5658
}

src/Windows/Audio Processing Windows/WhiteNoiseFilterWindow.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
using System.Windows.Media;
1212
using System.Windows.Media.Imaging;
1313
using System.Windows.Shapes;
14-
using AudioAnalysis;
1514
using SpecPlus.Design;
1615
using System.Windows.Threading;
1716

src/Windows/SpecPlusWindow.xaml.cs

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
11
using System;
22
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
63
using System.Windows;
74
using System.Windows.Threading;
85
using System.Windows.Controls;
9-
using System.Windows.Data;
10-
using System.Windows.Documents;
116
using System.Windows.Input;
127
using System.Windows.Media;
138
using System.Windows.Media.Imaging;
14-
using System.Windows.Navigation;
15-
using System.Windows.Shapes;
16-
17-
using System.ComponentModel;
18-
using System.Data;
19-
using System.Diagnostics;
20-
using System.Reflection;
219
using Spectrogram;
22-
using System.IO;
23-
using System.Globalization;
24-
using System.CodeDom;
25-
using NAudio.Wave.SampleProviders;
2610
using AudioAnalysis;
2711
using Microsoft.Win32;
2812
using FftSharp;
29-
using NAudio.Wave;
30-
using SpecPlus;
3113
using System.Windows.Controls.Primitives;
3214
using SpecPlus.Design;
3315
using SpecPlus.Windows;
@@ -269,6 +251,22 @@ public FFTs GetFFTs()
269251
return stft;
270252
}
271253

254+
private (int lowerTimeIndex, int higherTimeIndex, int lowerFreqIndex, int higherFreqIndex) WindowPoints()
255+
{
256+
Point startPoint = selectedWindow.startPoint;
257+
Point endPoint = selectedWindow.endPoint;
258+
(int timeIndex1, int freqIndex1) = PositionToIndices(startPoint);
259+
(int timeIndex2, int freqIndex2) = PositionToIndices(endPoint);
260+
if (freqIndex2 < freqIndex1)
261+
(freqIndex1, freqIndex2) = (freqIndex2, freqIndex1);
262+
if (timeIndex2 < timeIndex1)
263+
(timeIndex1, timeIndex2) = (timeIndex2, timeIndex1);
264+
265+
return (timeIndex1, timeIndex2, freqIndex1, freqIndex2);
266+
267+
}
268+
269+
272270
/**
273271
* Event Handlers
274272
*/
@@ -353,21 +351,6 @@ private void PaintGrid_MouseWheel(object sender, MouseWheelEventArgs e)
353351

354352
private void PauseButton_Click(object sender, RoutedEventArgs e) => TogglePause();
355353

356-
private (int lowerTimeIndex, int higherTimeIndex, int lowerFreqIndex, int higherFreqIndex) WindowPoints()
357-
{
358-
Point startPoint = selectedWindow.startPoint;
359-
Point endPoint = selectedWindow.endPoint;
360-
(int timeIndex1, int freqIndex1) = PositionToIndices(startPoint);
361-
(int timeIndex2, int freqIndex2) = PositionToIndices(endPoint);
362-
if (freqIndex2 < freqIndex1)
363-
(freqIndex1, freqIndex2) = (freqIndex2, freqIndex1);
364-
if (timeIndex2 < timeIndex1)
365-
(timeIndex1, timeIndex2) = (timeIndex2, timeIndex1);
366-
367-
return (timeIndex1, timeIndex2, freqIndex1, freqIndex2);
368-
369-
}
370-
371354

372355
private void ButtonFrequencyShifter_Click(object sender, RoutedEventArgs e) =>
373356
FrequencyShifterWindow.OpenWindow(this);

0 commit comments

Comments
 (0)