Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Sound in games - Rooms

, 31 Jul 2012
How to calculate a reverbration time in a room
WpfReverberationTime-noexe.zip
WpfReverberationTime
AbsorberList.xlsx
WpfReverberationTime.suo
WpfReverberationTime
AbsorberList.xlsx
bin
Debug
WpfReverberationTime.vshost.exe.manifest
My Project
MyExtensions
Settings.settings
obj
x86
Debug
frmAbsorber.baml
MainWindow.baml
WpfReverberationTime.g.resources
WpfReverberationTime.Resources.resources
WpfReverberationTime.vbproj.user
WpfReverberationTime.zip
AbsorberList.xlsx
WpfReverberationTime.suo
AbsorberList.xlsx
AmCharts.Windows.Design.dll
AmCharts.Windows.dll
WpfReverberationTime.exe
WpfReverberationTime.pdb
WpfReverberationTime.vshost.exe
WpfReverberationTime.vshost.exe.manifest
Release
Settings.settings
DesignTimeResolveAssemblyReferences.cache
DesignTimeResolveAssemblyReferencesInput.cache
frmAbsorber.baml
Interop.Microsoft.Office.Core.dll
MainWindow.baml
TempPE
My Project.Resources.Designer.vb.dll
WpfReverberationTime.exe
WpfReverberationTime.g.resources
WpfReverberationTime.pdb
WpfReverberationTime.Resources.resources
WpfReverberationTime.vbproj.GenerateResource.Cache
WpfReverberationTime.vbproj.ResolveComReference.cache
WpfReverberationTime.vbprojResolveAssemblyReference.cache
WpfReverberationTime_MarkupCompile.cache
WpfReverberationTime_MarkupCompile.i.cache
Release
WpfReverberationTime.vbproj.user
<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
   
            xmlns:am="http://schemas.amcharts.com/charts/wpf/2009/xaml"
    Title="MainWindow" Height="878" Width="850" Background="LightGray" >
    <StackPanel Background="LightGray" >
        <TabControl Height="831" Background="LightGray"  >
            <TabItem Name="tabInput" Header="Input data">
                <StackPanel>
                    <Label>This program calculates the reverberation time in a rectangular room</Label>
                    <WrapPanel>
                        <Label Width="210">Enter the hight of the room (z-axis):</Label>
                        <TextBox Name="txtHeightRoom" Width="100" BorderBrush="Black" BorderThickness="2"></TextBox>
                        <Label Width="100">Humidity in %:</Label>
                        <TextBox Name="txtHumidityRoom" Width="45" BorderBrush="Black" BorderThickness="2" Text="20"></TextBox>
                    </WrapPanel>
                    <WrapPanel>
                        <Label Width="210">Enter the width of the room (y-axis):</Label>
                        <TextBox Name="txtWidthRoom" Width="100" BorderBrush="Black" BorderThickness="2"></TextBox>
                    </WrapPanel>
                    <WrapPanel>
                        <Label Width="210">Enter the length of the room (x-axis):</Label>
                        <TextBox Name="txtLengthRoom" Width="100" BorderBrush="Black" BorderThickness="2"></TextBox>
                    </WrapPanel>
                    
                    <Label>Absorbers in Z direction</Label>
                    <ListView Height="150" Name="lstZ">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Width="500" Header="Absorber name">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Label  Content="{Binding Path=Name}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Width="140" Header="Amount (m2)">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Label  Content="{Binding Path=Area}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                    <WrapPanel>
                        <Button Name="btnZabsorbers" Height="28" Margin="5" IsEnabled="False" >Add absorbers in Z direction</Button>
                        <Label>Floor and ceiling area:</Label>
                        <Label Name="lblZarea"></Label>
                    </WrapPanel>


                    <Label>Absorbers in Y direction</Label>
                    <ListView Height="150" Name="lstY">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Width="500" Header="Absorber name">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Label  Content="{Binding Path=Name}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Width="140" Header="Amount (m2)">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Label  Content="{Binding Path=Area}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                    <WrapPanel>
                        <Button Name="btnYabsorbers" Height="28" Margin="5" IsEnabled="False" >Add absorbers in Y direction</Button>
                        <Label>Area of side walls:</Label>
                        <Label Name="lblYrea"></Label>
                    </WrapPanel>


                    <Label>Absorbers in X direction</Label>
                    <ListView Height="150" Name="lstX">
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Width="500" Header="Absorber name">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Label  Content="{Binding Path=Name}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                                <GridViewColumn Width="140" Header="Amount (m2)">
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate>
                                            <Label  Content="{Binding Path=Area}"/>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                </GridViewColumn>
                            </GridView>
                        </ListView.View>
                    </ListView>
                    <WrapPanel>
                        <Button Name="btnXabsorbers" Height="28" Margin="5" IsEnabled="False" >Add absorbers in X direction</Button>
                        <Label>Area of front and back walls:</Label>
                        <Label Name="lblXrea"></Label>
                    </WrapPanel>

                    
                    <Button Name="btnCalculate" Margin="10">Calculate reverbration time</Button>
                </StackPanel>
            </TabItem>
            <TabItem Name="tabResult" Visibility="Visible"   Header="Calculation results" Background="LightGray">
                <StackPanel>
                    <WrapPanel>
                        <Label Content="Schroeder frequency:" Margin="5"></Label>
                        <Label Name="lblSchroder" Margin="5"></Label>
                    </WrapPanel>
                    <WrapPanel>
                        <Label Content="Room radius:" Margin="5"></Label>
                        <Label Name="lblRoomRadius" Margin="5"></Label>
                    </WrapPanel>

                    <am:LineChart Name="chrt2" LegendEnabled="True" IsZoomable="True" Margin="10" PlotAreaMargin="50,20,30,70" Background="White" Foreground="Black" ConnectOverGaps="True"  HorizontalContentAlignment="Left"  Width="785" Height="420">
                        <am:LineChart.CategoryAxis>
                            <am:CategoryAxis ValuesEnabled="True" Stroke="Black" StrokeThickness="1"  ValuesRotationAngle="30"  ValuesFontSize="9" ValuesInside="False" />
                        </am:LineChart.CategoryAxis>

                        <!--<am:LineChart.LeftValueAxis>
                            <am:ValueAxis ValuesFormatString="0' dB'" StrictMinMax="True" StrokeThickness="1" SkipFirstValue="False" Minimum="0" Maximum="80" />
                        </am:LineChart.LeftValueAxis>-->

                        <am:LineChart.LeftValueAxisGrid>
                            <am:ValueGrid Stroke="Gray" StrokeThickness="1.1" CountHint="10"/>
                        </am:LineChart.LeftValueAxisGrid>
                    </am:LineChart>
                    <ListView Margin="10"  Name="lstResult" ItemsSource="{Binding}" Height="175">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Width="190" Header="Formula" >
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=Name}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                     
                            <GridViewColumn Width="60" Header="31Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f31Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="63Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f63Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="125Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f125Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="250Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f250Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="500Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f500Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="1000Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f1000Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="2000Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f2000Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="4000Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f4000Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="8000Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f8000Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                            <GridViewColumn Width="60" Header="16000Hz">
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate>
                                        <Label Content="{Binding Path=f16000Hz}"/>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>
                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
                </StackPanel>
            </TabItem>
        </TabControl>
    </StackPanel>
 
</Window>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Kenneth Haugland
Engineer
Norway Norway
I hope that you like the stuff I have created and if you do wish to say thank you then a donation is always appreciated.
You can donate here[^].

| Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 31 Jul 2012
Article Copyright 2012 by Kenneth Haugland
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid